ISO 8601 Format YYYY-MM-DDThh:mm:ss.sss[+-]hhmm

[email protected] (Carl Vincent)
Newsgroups perl.datetime
Message-ID <[email protected]>
Hi,

I'm looking to parse a datetime from ISO8601 use DateTime::Format::ISO8601

2012-04-24T10:39:00.000+0000

Which is formatted:

YYYY-MM-DDThh:mm:ss.ss[+-]hhmm

The support for time parts with this formatting seems to be in there, but the overall format doesn't seem to be there.

I've never worked with DateTime::Format::Builder before, but I'm guessing the format will look like:


            {
                #YYYY-MM-DDThhmmss.sss[+-]hhmm 1985-04-12T101530.5+0100 2004-10-20T101530.5-0500
                regex  => qr/^ (\d{4}) - (\d\d) - (\d\d)
                            T?? (\d\d) (\d\d) (\d\d) [\.,] (\d+)
                            ([+-] \d\d \d\d) $/x,
                params => [ qw( year month day hour minute second nanosecond time_zone ) ],
                postprocess => [
                    \&_fractional_second,
                    \&_normalize_offset,
                ],
            },

Is there any reason why this can't be added in?

With some guidance I could knock up a proper patch - I'm guessing I'd need to add a case into 02_examples.t too.

For the record, this is the format I'm getting back from the SalesForce API...

Cheers

Carl

--
     -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
     Carl Vincent             http://www.netskills.ac.uk/ (URL)
     Systems Manager                       0191 222 5003 (voice)
     Netskills, Newcastle University       0191 222 5001  (fax)
                 Netskills is a JISC Advance service
        Training  -  Development  -  Research  -  Innovation
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.