converting ISO8601 date and time string representations to datetime

Joel Goldstick joel.goldstick at gmail.com
Wed Aug 6 14:31:19 EDT 2014


On Fri, Aug 1, 2014 at 10:53 PM, Akira Li <4kir4.1i at gmail.com> wrote:
> Wolfgang Maier <wolfgang.maier at biologie.uni-freiburg.de> writes:
>
>> On 08/01/2014 01:30 AM, Roy Smith wrote:
>>> In article <mailman.12480.1406833307.18130.python-list at python.org>,
>>>   Albert-Jan Roskam <fomcl at yahoo.com> wrote:
>>>
>>>>> In article <mailman.12461.1406797909.18130.python-list at python.org>,
>>>>> Wolfgang Maier <wolfgang.maier at biologie.uni-freiburg.de> wrote:
>>>>>
>>>>>> Hi,
>>>>>> I'm trying to convert ISO8601-compliant strings representing dates or
>>>>>> dates and times into datetime.datetime objects.
>>>>>
>>>>> https://pypi.python.org/pypi/iso8601
>>>>
>>>> Yikes, what a regex. It must have been painstaking to get that right.
>>>> https://bitbucket.org/micktwomey/pyiso8601/src/2bd28b5d6cd2481674a8b0c54a8bba6
>>>> 4ab775f81/iso8601/iso8601.py?at=default
>>>
>>> It is a thing of beauty.
>>>
>>
>> No wonder I found it hard to write something that seemed bulletproof !
>
> It seems it supports only some custom subset of ISO 8601. There is rfc
> 3339 [1] that describes a profile of the ISO 8601 standard.
>
> rfc 3339 combines human readability with the simplicity of machine parsing.
>
> [1] http://tools.ietf.org/html/rfc3339
>
>
> --
> Akira
>
> --
> https://mail.python.org/mailman/listinfo/python-list

I just came across this package: http://crsmithdev.com/arrow/

Among other features it lists this: Gaps in functionality: ISO-8601
parsing, timespans, humanization


-- 
Joel Goldstick
http://joelgoldstick.com



More information about the Python-list mailing list