in reply to Re^5: Question regarding Time::Piece and timezones
in thread Question regarding Time::Piece and timezones

Daylight Saving.

Hm, yes, true if one reads the question without the context of the rest of the thread. My confusion stemsmed from the fact that the thread includes YMD and time zone names that would normally resolve that ambiguity. Update: Of course the time zone names used in the following are still ambiguous in other ways, as per my post above. Update 2&3: Upon rereading: the "in the US" bit is still confusing me, since this ambiguity is true of any time zone that observes DST, hence my assumption that this had something to do with AM/PM rather than DST. Other minor reformatting.

use warnings; use strict; use DateTime::Format::Strptime; my $strp = DateTime::Format::Strptime->new( pattern => '%F %H:%M %P %Z', on_error => 'croak', zone_map => { CST => '-0600', CDT => '-0500' } ); for my $str ('2020-03-08 1:23 AM CST','2020-03-08 1:23 AM CDT') { print $str, " = "; my $dt = $strp->parse_datetime($str); $dt->set_time_zone('UTC'); print $dt->strftime('%F %T %Z'), " = "; $dt->set_time_zone('America/Chicago'); print $dt->strftime('%F %T %Z'), "\n"; } __END__ 2020-03-08 1:23 AM CST = 2020-03-08 07:23:00 UTC = 2020-03-08 01:23:00 + CST 2020-03-08 1:23 AM CDT = 2020-03-08 06:23:00 UTC = 2020-03-08 00:23:00 + CST