in reply to convert GMT to other time zone using Date::Manip

I have used DateTime for date and time related stuff. There is a big collection of modules which will do all sort of date and time related calculations. From their FAQ on Time Zones:

my $source = DateTime->new( year => 1998, month => 4, day => 7, hour => 13, minute => 55, time_zone => 'America/New_York' ); my $result = $source->clone()->set_time_zone('America/Los_Angeles'); print $source->strftime("%F %r %Z"), " became ", $result->strftime("%F %r %Z"); # Prints: 1998-04-07 01:55:00 PM EDT became 1998-04-07 10:55:00 AM PDT

From the docs, it looks like Date::Manip is not properly supported anymore.

Replies are listed 'Best First'.
Re^2: convert GMT to other time zone using Date::Manip
by SBECK (Chaplain) on Feb 07, 2011 at 14:08 UTC
    In what way is Date::Manip not properly supported anymore? Date::Manip is very much a live, supported module. There were 8 updates last year, and one so far this year. I'm not sure what in the docs make it look like it's not properly supported... but it definitely IS!
Re^2: convert GMT to other time zone using Date::Manip
by thargas (Deacon) on Feb 07, 2011 at 12:47 UTC
    Seconded. I've found that the DateTime family of modules are the only ones which correctly handle timezones. They also explain why things don't always work the way you think at first that they should. I never look at any other perl date/time modules except where I'm using some module which uses them.

      Actually, Date::Manip (starting with version 6.00) handles ALL timezones included in the Olsen database (as well as military timezones, timezone names from Windows, etc.) correctly. This includes historical timezones (those no longer in use). The Date::Manip::TZ documentation covers this in detail as suggested elsewhere in this thread.

      Using the functional interface (i.e. Date_ConvTZ) to do the conversion is NOT recommended. It is strongly recommended that the object-oriented interface be used as it can handle timezones 100% correctly whereas the functional interface is serverly limited. A better solution to the problem in the original message would be:

      $d = new Date::Manip::Date; $d->parse($date); $d->convert($to);