Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^5: Question regarding Time::Piece and timezones

by hippo (Bishop)
on Jan 22, 2021 at 15:13 UTC ( [id://11127283]=note: print w/replies, xml ) Need Help??


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

What...?

Daylight Saving.


🦛

Replies are listed 'Best First'.
Re^6: Question regarding Time::Piece and timezones
by haukex (Archbishop) on Jan 22, 2021 at 16:17 UTC
    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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11127283]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-03-28 10:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found