in reply to Re^4: Converting from "time" into a nice string?
in thread Converting from "time" into a nice string?
The strings you're dealing with are (presumably) UNIX epoch time, the number of seconds elapsed since (usually) 00:00:00 January 1, 1970 UTC. The timezone determines the adjustment from UTC to your local timezone:
#!/usr/bin/perl for my $tz (qw[GMT America/Chicago Europe/London]) { local $ENV{TZ} = $tz; print "$tz: " . localtime '1226667500', "\n"; } __END__ GMT: Fri Nov 14 12:58:20 2008 America/Chicago: Fri Nov 14 06:58:20 2008 Europe/London: Fri Nov 14 12:58:20 2008
|
---|
In Section
Seekers of Perl Wisdom