"Surely there is some method or module that takes in a time specified in EST, and *poof* converts it to ACST?"
There certainly is...
use DateTime; my $time = DateTime->now( time_zone => 'America/New_York' ); $time->set_time_zone( 'Australia/South' ); print "$time\n";
If you want to use a specific time and date rather than "now", just use new instead of now to create the object...
my $time = DateTime->new( year => 2007, month => 12, day => 28, hour => 18, minute => 30, second => 0, time_zone => 'America/New_York', );
"typing the 'date' command on the command line actually yields a "CST" timezone, which can be quite ambiguous with the American "CST", is there some way to differentiate the two to perl?
Not reliably, which is why it's strongly recommended you use the named timezones rather than the abbreviations, there are quite a few abbreviations that aren't unique. On unix machines where you can't tell which one 'date' refers to, you can often tell the real timezone by looking at the file /etc/localtime (the file info, not the contents, which are binary), on my machine it looks like this:
[jason@critter ~ 0]$ date Fri Dec 28 13:24:04 EST 2007 # oops, there are two ESTs, one at -0500 and one at +1000/+1100, which + one is it? [jason@critter ~ 0]$ ls -l /etc/localtime lrwxr-xr-x 1 root wheel 30 Dec 5 12:06 /etc/localtime@ -> /usr/sha +re/zoneinfo/US/Eastern
| We're not surrounded, we're in a target-rich environment! |
|---|
In reply to Re: Timezone conversion in Perl
by jasonk
in thread Timezone conversion in Perl
by woei
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |