use POSIX qw(strftime); my $w3cstring = strftime "%FT%H:%I:%S", localtime; print $w3cstring;