use POSIX qw(strftime); my $w3cstring = strftime "%FT%H:%I:%S", localtime; print $w3cstring; #### 2013-11-26T14:02:48