in reply to Re^2: Question regarding Time::Piece and timezones
in thread Question regarding Time::Piece and timezones
I would appreciate your help in correcting my error. 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. Almost all my work is in GMT/UTC so I don't often work with local time myself.
Update: BTW, there are all kind of "weirdo" time zones in the world 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.use strict; use warnings; use 5.010; use DateTime; use DateTime::Format::Strptime; $|=1; my $str = 'Wed, 13 Jan 2021 17:22:23'; my $pattern = '%a, %d %b %Y %T'; my $strp = DateTime::Format::Strptime->new( pattern => $pattern, time_zone => 'CST', zone_map => { CST => '-0700', EST => '-0600' } ); say "I got this far (not!)"; my $dt = $strp->parse_datetime( $str ); say "String: $str"; say "DateTime: $dt"; say ''; __END__ Invalid offset: CST
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Question regarding Time::Piece and timezones
by haukex (Archbishop) on Jan 22, 2021 at 14:51 UTC | |
by hippo (Archbishop) on Jan 22, 2021 at 15:13 UTC | |
by haukex (Archbishop) on Jan 22, 2021 at 16:17 UTC | |
by Marshall (Canon) on Jan 23, 2021 at 02:44 UTC | |
|
Re^4: Question regarding Time::Piece and timezones
by Fletch (Bishop) on Jan 21, 2021 at 06:39 UTC | |
by haukex (Archbishop) on Jan 22, 2021 at 14:07 UTC | |
by Marshall (Canon) on Jan 23, 2021 at 02:03 UTC |