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

Change character datatypes to Time and Date fields 1

Status
Not open for further replies.

kernal

Technical User
Feb 27, 2001
415
US
I'm using crystal 9 with a csv file:

There is a date and time field that are character datatypes.

Date Time
Tue 07/28/2009 12:59:01.10

How do I create a formula for the date field so it removes the day of the week and space(i.e. "Tue ") and makes it a date field?

How do I create a formula for the time field so it removes the period and the last 2 digits (i.e. ".10") and makes it a time field?

Needed:

Date Time
07/28/2009 12:59:01

Thanks in advance for your help.
 
//{@date}:
stringvar array x := split({table.stringdate}," ");
date(x[2]);

//{@time}:
stringvar array z := split({table.stringtime},":");
time(val(z[1]),val(z[2]),val(left(z[3],2)))

-LB
 
Worked great. Thanks LB for your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top