On 25/07/2014 17:54, Chris Knipe wrote:
Hi All,

I have the odd (very rare) case where I am given a date in an incorrect
format.  I already use Date::Parse to convert the dates to a unix
timestamp, and it’s working incredibly well.  However, on the rare case
that I get incorrect dates, Date::Parse does not like them either and
errors out.  The formats in question that I can’t parse basically looks like

Thu, 23 Oct 2008 12:06:48+0400

Note the lack of a space between the seconds and the timezone.

Date::Parse is amiss here because (at least) the time part of that
string complies with ISO 8601. i.e. the space *shouldn't* be there.

Ridiculously, you must *pay* ISO to get a copy of their standard, but
W3C's version is here

    http://www.w3.org/TR/NOTE-datetime

To fix the immediate problem I would amend every date-time string using

    s/\S\K([-+][0-9]+)\z/ $1/

but I also think it's worth emailing

    Graham Barr <gb...@pobox.com>

the author of Date::Parse to get his angle on this.

Rob







---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to