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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Part of string to datetime

Status
Not open for further replies.

bist

Programmer
Sep 10, 2003
1
US
I have a string field that says
Deadline set to "10.09.2003 09:23 ECT"

Can anyone help me with how to take out the date/time and convert it to a datetime-field?

Thanks!

Britist
 
try CDateTime(your.string)

Madawc Williams
East Anglia, Great Britain
 
Something like this might work:

stringvar comment := {table.string};
stringvar extractdatetime := mid(comment,instr(comment,'"')+1, instrrev(comment,'"', -1) - instr(comment,'"')-5);
cdatetime(replace(extractdatetime,".",","));

This also eliminates the "ECT" (which you can't include in the conversion to datetime) so that the result using your example above would be:

10/09/2003 09:23:00AM

-LB

 
Or:

cdatetime(replace(left({table.field},16),".","/"))

This eliminates the timezone, if you need to allow for various timezones, you'll need to use a formula or a UFL (milletsoftware.com has a UFL.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top