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

Converting DateTime to Date and Reformatting Dates

Status
Not open for further replies.

kime1974

Programmer
Oct 30, 2006
36
0
0
US
I am using Crystal 8.5 and need to change the format of a date time field to a specific format. I can do it within the report, but when it is exported to Access it loses its format.

Here is the current format
11/1/2006 12:00:00AM

I need to format it in a formula to
2006-11-01-12:00:00

In other cases, I need to format
11/1/2006 12:00:00AM

to
2006-11-01

Thanks!
Kim
 
Try ToText. Something like
Code:
ToText({your.date}, "yyyy-MM-dd hh:mm:ss") & @As_AM_PM
@As_AM_PM is a field that would say AM or PM depending on the time. There may be a clever way to do it using ToText, I never use time which we don't store so I'm not sure. Check the HELP option on Crystal.

[yinyang] Madawc Williams (East Anglia, UK). Using Windows XP & Crystal 10 [yinyang]
 
You can get the AM/PM by using:

ToText({your.date}, "yyyy-MM-dd hh:mm:ss tt")

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top