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!

Daylight Savings Change

Status
Not open for further replies.

lgard3

Technical User
Jun 19, 2006
4
US
Hi. I am on Crystal Reports XI Release 2.

I have a report that queries a db that stores all date/time information in UTC time. So, I have to convert it to my local timezone for any kind of reporting (I am in Chicago - CST).

I thought I figured out the formula I needed to do this, but after this weekend I can see that it is not in fact working how I expect. Here's the formula:

ShiftDateTime ({AH.AH_TIMESTAMP4},"UTC,000,UTC","CST,300,CDT") in {@StartTime}to {@EndTime}

My goal here is to have the report automatically determine if it is CST or CDT and adjust the timeframe accordingly. So far it seems the best I can do is modify this report 2x a year to fix the daylight savings time adjustment.

Any ideas/advice? Thanks.
 
if you know the dates it changes (and as long as the gov't doesn't mess with it we ususally do!) you can add logic to evaluate the date and the execute the appropriate formula, now with the current method of implementation for DST, it will be a number of conditions based on the year.

Starting with something like this:

IF year({table.Date}) = "2011"
then
(
IF {table.Date} in [DateSerial(2011,03,13) to DateSerail(2011,11,06)
then
ShiftDateTime ({AH.AH_TIMESTAMP4},"UTC,000,UTC","CST,300,CDT") in {@StartTime}to {@EndTime}
ELSE
ShiftDateTime(etc, etc, etc for Standard Time)
)
ELSE
IF year({table.Date}) - "2012"
then
IF {table.Date} in [DateSerial(2011,03,11) to DateSerail(2011,11,04)
THEN....................
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top