convert datetime format yyyy-mm-dd hh:mm:ss (Might be a string) into UTC, Looking into DateTime but I don't see how to parse the string?
UPDATE:
Is this working correctly?
require 5.002;
use strict;
use warnings;
use DateTime::Format::DateManip;
my $string = '2010-02-28 00:00:00';
my @dates = (
$string
);
for my $date ( @dates ) {
my $dt = DateTime::Format::DateManip->parse_datetime( $date );
die "Cannot parse date $date, Please use a valid date in this format 'yyyy-mm-dd mm:hh:ss'" unless defined $dt;
print $dt."\n";
$dt->set_time_zone( 'UTC' );
print $dt."Z\n"; # Is this correct???
}