Created
July 31, 2009 03:08
-
-
Save pjf/159065 to your computer and use it in GitHub Desktop.
Changing the timezone is as easy as ->set_time_zone()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -w | |
use 5.010; | |
use strict; | |
use warnings; | |
use autodie; | |
use DateTime; | |
my $dt = DateTime->now; | |
foreach my $timezone ( qw( Australia/Sydney GMT America/Los_Angeles ) ) { | |
$dt->set_time_zone( $timezone );; | |
printf( | |
"%20s %10s %3s %2s:%2s\n", | |
$timezone, $dt->ymd, $dt->day_abbr, $dt->hour, $dt->minute | |
); | |
} | |
__END__ | |
Australia/Sydney 2009-07-31 Fri 13:11 | |
GMT 2009-07-31 Fri 3:11 | |
America/Los_Angeles 2009-07-30 Thu 20:11 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment