I have a date/time like this: 2015-07-31T13:30:00.000+01:00 And I want to convert it to normal date and time using Perl and Time::Piece->strptime
Here is my code:
sub changeDateFormat {
my ($date, $fromFormat, $toFormat) = (@_);
return Time::Piece->strptime($date, $fromFormat)->strftime($toFormat);
}
The call:
print changeDateFormat($that_date, '%Y-%m-%dT%H:%M:%S.%N+%z', '%Y:%m:%d');
I think that .000 are nano seconds and +01.00 stands for time zone. But the given code gives this: Error parsing time at /usr/lib64/perl5/Time/Piece.pm line 470
Any help is appreciated.