Read about
DateTime if you're interested
use strict;
use warnings;
use DateTime;
my $now = DateTime->now;
print "$now\n";
print "year: ", $now->year, "\n";
for my $what( qw/ year month day hour min sec / ){
print "$what: ", $now->$what, "\n";
}
print DateTime->now( qw! time_zone America/Los_Angeles ! )->strftime(q
+!%F %T%z!), "\n";
print DateTime->now( qw! time_zone America/Los_Angeles ! )->strftime(q
+!%T, %a %b %d, %Y!), "\n";
__END__
2014-01-23T22:38:31
year: 2014
year: 2014
month: 1
day: 23
hour: 22
min: 38
sec: 31
2014-01-23 14:38:31-0800
14:38:31, Thu Jan 23, 2014