I want the system date to be converted to ISO 8601 format. code:
my $now = time();
my $tz = strftime("%z", localtime($now));
$tz =~ s/(\d{2})(\d{2})/$1:$2/;
print "Time zone *******-> \"$tz\"\n";
# ISO8601
my $currentDate = strftime("%Y-%m-%dT%H:%M:%S", localtime($now)) . $tz;
print "Current date *******-> \"$currentDate\"\n";
Current output is:
Time zone *******-> "-04:00"
Current date *******-> "2014-06-03T03:46:07-04:00"
I want the current date to be in format "2014-07-02T10:48:07.124Z", So that I can compute the difference between the two.
strftime
function? – QueridasDateTime::Format::ISO8601
– Commando