in reply to Re^3: Question regarding Time::Piece and timezones
in thread Question regarding Time::Piece and timezones
I am also curious as to what happens with these ambiguous local times, like in the US 1:23 AM can occur twice during the same day.
What...? Anyway, see the %p and %P tokens.
Invalid offset: CST
As per DateTime::Format::Strptime: "By default, the parser will die when it parses an ambiguous abbreviation."
$ perl -wMstrict -MDateTime -le 'print DateTime->now(time_zone=>$_)->s +trftime("%Z %z") for qw# America/Havana Asia/Shanghai America/Chicago + #' CST -0500 CST +0800 CST -0600
See also List of time zone abbreviations, ISO8601 Time zone designators, and Names of time zones.
Also occasionally a specific location can change its time zone - the International Date Line was moved some years back - this affected some islands in the Pacific.
Hence the existence of location-based time zone names that are unambiguous in that respect.
$ perl -wMstrict -MDateTime -le 'print DateTime->new(year=>$_,time_zon +e=>"Pacific/Apia")->strftime("%Y %z") for qw/ 2010 2012 /' 2010 -1100 2012 +1400
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^5: Question regarding Time::Piece and timezones
by hippo (Chancellor) on Jan 22, 2021 at 15:13 UTC | |
by haukex (Bishop) on Jan 22, 2021 at 16:17 UTC | |
Re^5: Question regarding Time::Piece and timezones
by Marshall (Canon) on Jan 23, 2021 at 02:44 UTC |