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

Converting UTC to CST/CDT TimeZone

Status
Not open for further replies.

lgard13

Technical User
May 2, 2008
1
US
Hi. I am a new user and trying to build some reports on an application that stores the date/time in UTC time. I need to convert this to CST or CDT timezone depending on whether or not we are using Daylight Savings or not. I have read the other posts and I was able to use the following and get the date converted:

DateAdd ("h",7,{OH.OH_MODDATE})

This works great! However, I do not really want to modify this 2x a year. I'd prefer it to be automatic. I did come across another post where it referenced the creating a SQL expression to handle this and I also tried to figure out how to use the ShiftDateTime function, but I cannot get this to work.

Can anyone give me details (very specific) on how to automate this timezone switch? Thanks in advance. This is my first time on the forum and it helped me get a lot further than I was I just need a little more help!

Laura
 
I believe Crystal 2008 has this functionality built-in.

If you are running an earlier version of Crystal, there is at least one 3rd-party UFL (User Function Library) among those listed at that provides this functionality.

- Ido

view, e-mail, export, burst, distribute, and schedule Crystal Reports.
 
Post your ShiftDateTime formula. I've used it in the past to do what you're trying to do only from EST to PST. But the format should be basically the same:

Code:
ShiftDateTime {your_datetimefield}, "UTC,000,UTC", "CST,[b]480[/b],CDT")

Replace that bolded 480 to however many minutes Central time is offset from UTC. 480 is PST (8 hours)

 
Error in my first post: I forgot the first parentheses.

Code:
ShiftDateTime [b]([/b]{your_datetimefield}, "UTC,000,UTC", "CST,[b]480[/b],CDT")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top