FAQ
I was trying to answer this question on how to parse an incomplete date:
http://www.perlmonks.org/?node_id=1163514

I've tried this:

use DateTime::Format::ISO8601;
use DateTime::Incomplete;
use DateTime::TimeZone;
use Data::Dumper;

my $tz = DateTime::TimeZone->new( name => "America/New_York" );
my $base_datetime = DateTime::Incomplete->new( time_zone => $tz );
my $iso8601 = DateTime::Format::ISO8601->new( base_datetime =>
$base_datetime, );
my $dt = DateTime::Format::ISO8601->parse_datetime( "2016" );
print Dumper({ year => $dt->year, month => $dt->month, day => $ft->day });

The time_zone parameter seems to be required by DateTime.pm, I get an
error otherwise.

It seems to enter an infinite loop, I couldn't investigate enough yet.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupdatetime @
categoriesperl
postedMay 20, '16 at 8:03a
activeMay 20, '16 at 8:03a
posts1
users1
websitemetacpan.org...

1 user in discussion

Flavio S. Glock: 1 post

People

Translate

site design / logo © 2019 Grokbase