Subject: | Determine Correct Time zone |
I am trying to use Date::Manip to display the correct time according to the TZ specified for any time() since epoch. Here's the test code:
use Date::Manip;
$ENV{TZ}='EST05EDT';
my $tz = Date_TimeZone;
print "TZ: $tz\n";
my $date = ParseDate("today");
my $pdate = UnixDate($date, "%m/%d/%Y %H:%M:%S %Z");
print "Today: $pdate\n";
$date = time() - 86400*2;
$date = ParseDateString ("epoch $date");
$pdate = UnixDate($date, "%m/%d/%Y %H:%M:%S %Z");
print "Two days ago: $pdate\n";
Note that 2 days ago it was EDT.. Hoewever the test run results in:
TZ: EST
Today: 10/31/2005 10:58:42 EST
Two days ago: 10/29/2005 10:58:42 EST