Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

Re: DateTime and ISO8601

by SBECK (Hermit)
on May 19, 2016 at 20:13 UTC ( #1163523=note: print w/replies, xml ) Need Help??

in reply to DateTime and ISO8601

This is not precisely what you are looking for, but I'll offer it as an alternative.

I found the same problem when I was adding support for ISO8601 dates to Date::Manip, and I wanted to find out which fields had been set.

Date::Manip (which will parse all of the ISO8601 dates) has a method (complete) which will tell you what fields were explicitly added, and which are implied. So you end up with:

use Date::Manip::Date; my $obj = new Date::Manip::Date; $obj->parse("2000-06-01-00:00"); print $obj->value(),"\n"; print $obj->complete('h'),"\n"; print $obj->complete('m'),"\n"; print $obj->complete('s'),"\n";
2000060100000 1 1 0
So, if you can't get DateTime to do it, you may want to look at Date::Manip.

Replies are listed 'Best First'.
Re^2: DateTime and ISO8601
by philkime (Beadle) on May 19, 2016 at 20:47 UTC
    Ah, thank you, last time I looked at Date::Manip, I don't think ->complete() was in there. The tricky part is that I need DateTime's era (BC/AD etc) output support.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1163523]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2020-10-26 08:08 GMT
Find Nodes?
    Voting Booth?
    My favourite web site is:

    Results (250 votes). Check out past polls.