#! perl use strict; use warnings; use feature 'state'; use Date::Manip; my $est = localtime; my $tz = new Date::Manip::TZ; my ($error, $date) = $tz->convert(ParseDate($est), 'Australia/Brisbane', 'CET'); if ($error) { warn "Error $error. Failed to convert date and time$!"; } else { my $cet = sprintf("%s %s %d %02d:%02d:%02d %d", get_day_of_week($date), get_month($date->[1]), @$date[2 .. 5, 0]); print "My time (EST) is $est\n"; print "Your time (CET) is $cet\n"; } sub get_day_of_week { state $days = [ qw(Mon Tue Wed Thu Fri Sat Sun) ]; my ($date) = @_; my $base = new Date::Manip::Base; my $index = $base->day_of_week($date); return $days->[ $index - 1 ]; } sub get_month { state $months = [ qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec) ]; my ($month) = @_; return $months->[ $month - 1 ]; } #### 16:42 >perl 753_SoPW.pl My time (EST) is Tue Oct 22 16:42:35 2013 Your time (CET) is Tue Oct 22 08:42:35 2013 16:42 >