Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

use Time::gmtime;
use Time::Local;


Please advise how I can get east coast time instead of gmt time?
The perldoc -q time gave didnt give me any info on this.

Replies are listed 'Best First'.
Re: getting East Coast time.
by hacker (Priest) on Aug 26, 2002 at 11:30 UTC

    To get your local time (perldoc -f localtime()):

    perl -e 'my $date = localtime(time()); print $date;'

    To get GMT time (perldoc -f gmtime()):

    perl -e 'my $date = gmtime(time()); print $date;'

    To get EST:

    perl -e 'print "TZ=$ENV{TZ}: ", scalar localtime, "\n"; $ENV{TZ}="US/Eastern"; print "TZ=$ENV{TZ}: ", scalar localtime, "\n"'