in reply to The funtion - Date_ConvTZ is not working correctly when converting from EST to CST

From the doc to Date::Manip:

VERSION 5 AND VERSION 6

Date::Manip version 6.00 was a complete rewrite of the module (for more information, please refer to the Date::Manip::Changes5to6 document).

The document linked to in that Readme contains all you need to know about the changes to TimeZone handling in Date::Manip, including at http://search.cpan.org/~sbeck/Date-Manip-6.58/lib/Date/Manip/Changes5to6.pod#TIME_ZONE_SUPPORT.

Personally I use DateTime for all date ... er, manipulation. (Note that you should let it handle Daylight Savings Time automatically for you, i.e. don't specify CST but rather "America/Chicago" or similar.)

$ perl -MDateTime -E ' my $dt = DateTime->now; say join " ", $dt, $dt->time_zone_short_name; $dt->set_time_zone("America/Chicago"); say join " ", $dt, $dt->time_zone_short_name; '
Output:
2017-05-01T16:53:29 UTC 2017-05-01T11:53:29 CDT

Hope this helps!

Update: added DT example


The way forward always starts with a minimal test.
  • Comment on Re: The funtion - Date_ConvTZ is not working correctly when converting from EST to CST
  • Select or Download Code

Replies are listed 'Best First'.
Re^2: The funtion - Date_ConvTZ is not working correctly when converting from EST to CST
by mangrove (Acolyte) on May 01, 2017 at 19:07 UTC
    Thanks for the info as well as the new suggestion code, I will try that.