use warnings; use strict; use Time::Piece; my $fmt = '%d %b %Y %T %z'; # %z instead of %Z appears to work my $str = localtime->strftime($fmt); print $str, "\n"; my $strtime = Time::Piece->strptime($str, $fmt); print $strtime->strftime($fmt), "\n";