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!

StringDateTime to DateTime? 2

Status
Not open for further replies.

Buckaroo8

Programmer
Aug 6, 2003
27
US
I have a string field {Table.AdmitDTM} with strings like "2003-07-17 17:23:00.000".
I need to calculate the difference in days against the CurrentTime. However the DateTimeValue will not take {Table.AdmitDTM} as one of its parameters. So how do I convert the filed into a DateTime data type, OR is there another way to accomplishe the calculation?
 
You could probably safely ignore the three decimal places after the seconds field, which might be causing the problem. The following will return a datetime:

datetime(left({table.date},19))

Then for the datediff you could use:

datediff("d", datetime(left({table.date},19)), currentdatetime)

-LB
 
Try:

cdatetime(left("2003-07-17 17:23:00.000",19))

Replacing "2003-07-17 17:23:00.000" with your datetime field.

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top