in reply to Re^2: Convert GMT timestamp to EST/EDT (Time::Local + Time::Piece)
in thread Convert GMT timestamp to EST/EDT

This only works if your local time zone happens to be EST/EDT.
  • Comment on Re^3: Convert GMT timestamp to EST/EDT (Time::Local + Time::Piece)

Replies are listed 'Best First'.
Re^4: Convert GMT timestamp to EST/EDT (Time::Local + Time::Piece)
by Your Mother (Archbishop) on Jul 28, 2015 at 19:26 UTC

    The title of the thread is "Convert GMT timestamp to EST/EDT." :P

      Right, but the code posted anonymously converts to local time instead. That may not be correct.

      On second thought, he surely meant for $ENV{TZ} = "US/Eastern"; to remain used, in which case his code works. I didn't quite understand his point (that you can make things more complicated by replacing sprintf with Time::Piece) when I wrote my comment. If you want to use strftime instead of sprintf, you might as well grab it directly from POSIX instead of involving (rather horrible) Time::Piece.