Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

extracting a date from a string 1

Status
Not open for further replies.

iwm

Programmer
Feb 7, 2001
55
0
0
US
I am attempting to extract a date from a string. The date is enclosed in parenthesis. I tried to accomplish this by using the Mid function with ASCII values (chr(40) and chr(41)) representing parenthesis(see below).

STRING: (03/25/05)Perishable Goods

FORMULA: Mid ({Inputstring}, chr(40),chr(41))

This produces an error message stating that a number is required for the start(chr(40)) and the length (chr(41)).

The date can take various formats((03/25/05) or (March 25, 2005)or (3/25/2005)etc.), but is always contained within parenthesis.

Do you have any suggestion on extracting a date from a string?

Any assistance is greatly appreciated.
 
you can use the mid function like this Mid ('(03/25/05)Perishable Goods',2,8) to get the date portion out of a String

HTH
 
This should take care of any format, as long as the parentheses are there:

Mid({Table.Field}, InStr({Table.Field},"(") + 1, InStr({Table.Field}, ")")-2);

-dave
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top