Created
October 17, 2012 09:19
-
-
Save aanoaa/3904636 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
use DateTime::Format::ISO8601; | |
my $str = '15:36:08 UTC Fri Oct 12 2012'; | |
my @date = split / /, $str; | |
my %MMAP = ( | |
Oct => '10', | |
); | |
my %TMAP = ( | |
UTC => 'Z', | |
KST => '+09', | |
); | |
$date[0] =~ s/://g; | |
my $newStr = sprintf "%s%s%sT%s%s", $date[5], $MMAP{$date[3]}, $date[4], $date[0], $TMAP{$date[1]}; | |
print "$newStr\n"; | |
my $dt = DateTime::Format::ISO8601->parse_datetime($newStr); | |
print $dt->ymd, "\n"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment