When I try to create a DateTime object after receiving the following date format:
Fri 01 Oct 2010 12:19:54 AM JMT
I parse the day,month,year,time, and timezone.
However, creating a DateTime object using an abbreviated timezone does not appear to work.
# ... After parsing and converting to epoch...
my $dt = DateTime->from_epoch( epoch => $date_epoch,
time_zone => 'JMT' );
I get:
Invalid offset: JMT
Is there a way to supply DateTime an abbreviated timezone?
If not, what's the best way to co开发者_运维问答nvert an abbreviated timezone to a full timezone string (in Perl).
From DateTime::TimeZone:
It is strongly recommended that you do not rely on these names for anything other than display. These names are not official, and many of them are simply the invention of the Olson database maintainers. Moreover, these names are not unique. For example, there is an "EST" at both -0500 and +1000/+1100.
精彩评论