Created
January 5, 2015 08:26
-
-
Save ywatase/f5f397764a879eaeb619 to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use feature 'say'; | |
use DateTime::Format::HTTP; | |
use DateTime; | |
sub t { | |
my ($y,$m,$d) = split /\//, shift; | |
my $dt = DateTime->new(year => $y, month => $m, day => $d, hour => 0, minute=> 0, second => 0); | |
my $class = 'DateTime::Format::HTTP'; | |
say "$class : ", $class->format_datetime($dt); # Format as GMT ASCII time | |
say "DateTime(YYYY-MM-dd): ", $dt->format_cldr('YYYY-MM-dd'); | |
say "DateTime(yyyy-MM-dd): ", $dt->format_cldr('yyyy-MM-dd'); | |
say "DateTime(yyyy-mm-dd): ", $dt->format_cldr('yyyy-mm-dd'); | |
say "DateTime(YYYY-MM-DD): ", $dt->format_cldr('YYYY-MM-DD'); | |
# $time = $class->parse_datetime($string); # convert ASCII date to machine time | |
} | |
t('2013/12/31'); | |
t('2014/12/31'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment