Subject: | Wrong date being returned |
For example, instead of 2011-04-30, I am get back 2052-08-27.
The results are pasted after the __END__ statement in the attached code
snippet.
Windows XP Home SP3 Build 2600, X86-based, 32 bit.
Time Zone: Eastern Daylight Time
ActiveState Perl v5.12.2 on Windows XP Version 5.1.2600
Binary build 1202 [293621]
$DateTime::VERSION 0.68
$DateTime::Format::Epoch::VERSION 0.13
Subject: | test.pl |
use DateTime;
use DateTime::Format::Epoch;
my $epoch = time();
print ("time() epoch is $epoch\n");
$dt = DateTime->from_epoch(
epoch=> $epoch,
time_zone => "America/New_York",
);
print("DateTime Formatted yyyy-mm-dd is ", $dt->ymd('-'), "\n");
my $formatter = DateTime::Format::Epoch->new( epoch => $dt );
my $dt2 = $formatter->parse_datetime( $epoch );
print ("formatter->parse_datetime dt2 = ", $dt2, "\n");
$formatter->format_datetime($dt2);
print ("formatter->parse_datetime given dt2: ", $formatter->format_datetime($dt2), "\n");
__END__
The results are pasted below.
C:\>perl test.pl
time() epoch is 1304196367
DateTime Formatted yyyy-mm-dd is 2011-04-30
formatter->parse_datetime dt2 = 2052-08-27T17:32:14
formatter->parse_datetime given dt2: 1304196367