in reply to GMT to Chicago TIme

I need to convert time from GMT to Chicago local time.

Well, right now in CDST (Central Daylight Standard Time), Add 5 hours to local time to get the time in Greenwich England. When Chicago "goes off daylight savings time", (like the saying: "fall back"), the time difference will be 6 hours instead of 5 hours.

There are various Perl modules that calculate date/times. But basically they all involve a "trip through GMT". GMT in a Unix sense, is a continuously incrementing number of seconds. CST or CDST is a presentation of GMT. 1:30 AM local time could possibly mean 2 different GMT times for the same local day/time ( the "spring forward, fall back" idea). What "local time" is, is a political decision.

There is a boundary condition. But essentially the date/time module will know whether to subtract 5hrs*60min*60sec or 6hrs*60min*60sec from Unix "GMT epoch seconds" to get local time. Hard code this or ask a module that has a continuously updated database.

Replies are listed 'Best First'.
Re^2: GMT to Chicago TIme
by ikegami (Patriarch) on May 22, 2010 at 01:54 UTC
    I don't understand your point. The module he is using is quite aware as to when Chicago uses DST and when it doesn't.
    print(fromGMT('20090101', '12:00:00'), "\n"); # 06:00:00 print(fromGMT('20090701', '12:00:00'), "\n"); # 07:00:00
      My brain was elsewhere on this one...burning a 7 DVD set for one project while working on another coding project. Shouldn't have even been adding a 3rd thing to the multi-tasking list by answering a Perl question. I tried to do too much at once and quality of the result is less than I would have desired. Sorry. My oops.