[issue15873] "datetime" cannot parse ISO 8601 dates and times

2013-03-09 Thread Anders Hovmöller
Anders Hovmöller added the comment: Éric Araujo: absolutely. Although I think my code can be improved (speed wise, elegance, etc) since I just wrote it quickly a weekend :) -- ___ Python tracker __

[issue15873] "datetime" cannot parse ISO 8601 dates and times

2013-03-08 Thread Éric Araujo
Éric Araujo added the comment: Are you offering the module for inclusion in the stdlib? -- ___ Python tracker ___ ___ Python-bugs-list

[issue15873] "datetime" cannot parse ISO 8601 dates and times

2013-03-07 Thread Anders Hovmöller
Anders Hovmöller added the comment: I've written a parser for ISO 8601: https://github.com/boxed/iso8601 Some basic tests are included and it supports most of the standard. Haven't gotten around to the more obscure parts like durations and intervals, but those are trivial to add... --

[issue15873] "datetime" cannot parse ISO 8601 dates and times

2012-11-01 Thread kirpit
Changes by kirpit : -- nosy: +kirpit ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mai

[issue15873] "datetime" cannot parse ISO 8601 dates and times

2012-10-31 Thread Éric Araujo
Changes by Éric Araujo : -- nosy: +eric.araujo ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyth

[issue15873] "datetime" cannot parse ISO 8601 dates and times

2012-10-31 Thread flying sheep
flying sheep added the comment: there is a module that parses those strings pretty nicely, it’s called pyiso8601: http://code.google.com/p/pyiso8601/ in the context of writing a better plistlib, i also needed the capability to parse those strings, and decided not to use the sucky incomplete im

[issue15873] "datetime" cannot parse ISO 8601 dates and times

2012-09-10 Thread Roy Smith
Roy Smith added the comment: Ooops, clicked the wrong button. -- Added file: http://bugs.python.org/file27165/test-cases.py ___ Python tracker ___ ___

[issue15873] "datetime" cannot parse ISO 8601 dates and times

2012-09-10 Thread Roy Smith
Roy Smith added the comment: I've started collecting some test cases. I'll keep adding to the collection. I'm going to start trolling ISO 8601:2004(E) for more. Let me know if there are other sources I should be considering. -- ___ Python tracker

[issue15873] "datetime" cannot parse ISO 8601 dates and times

2012-09-10 Thread Matej Cepl
Changes by Matej Cepl : -- nosy: +mcepl ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/

[issue15873] "datetime" cannot parse ISO 8601 dates and times

2012-09-09 Thread Alexander Belopolsky
Changes by Alexander Belopolsky : -- assignee: -> belopolsky ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: h

[issue15873] "datetime" cannot parse ISO 8601 dates and times

2012-09-09 Thread Jesús Cea Avión
Changes by Jesús Cea Avión : -- nosy: +jcea ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.

[issue15873] "datetime" cannot parse ISO 8601 dates and times

2012-09-09 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: > For what parts of ISO 8601 to accept, there's a standard: RFC3339 This is almost indistinguishable from the idea of accepting .isoformat() and str() results. From what I see the only difference is that 't' is accepted for date/time separator and 'z' i

[issue15873] "datetime" cannot parse ISO 8601 dates and times

2012-09-09 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: > I realize that while that is certainly an absolute lower bound, > it's almost certainly not sufficient. The most common use case > I see on a daily basis is parsing strings that look like > "2012-09-07T23:59:59+00:00". This is exactly what isoformat() o

[issue15873] "datetime" cannot parse ISO 8601 dates and times

2012-09-09 Thread John Nagle
John Nagle added the comment: For what parts of ISO 8601 to accept, there's a standard: RFC3339, "Date and Time on the Internet: Timestamps". See section 5.6: date-fullyear = 4DIGIT date-month = 2DIGIT ; 01-12 date-mday = 2DIGIT ; 01-28, 01-29, 01-30, 01-31 based on

[issue15873] "datetime" cannot parse ISO 8601 dates and times

2012-09-09 Thread Roy Smith
Roy Smith added the comment: I see I mis-stated my example. When I wrote: s = str(d1) d2 = datetime.datetime(s) assert d1 == d2 what I really meant was: s = d1.isoformat() d2 = datetime.datetime(s) assert d1 == d2 But, now I realize that while that is certainly an absolute lower bound, it's

[issue15873] "datetime" cannot parse ISO 8601 dates and times

2012-09-09 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: On Sep 9, 2012, at 8:15 AM, Roy Smith wrote: > We need to define the scope of what input strings will be accepted. Since it is easier to widen the domain of acceptable arguments than to narrow it in the future, I would say let's start by accepting str(x

[issue15873] "datetime" cannot parse ISO 8601 dates and times

2012-09-09 Thread Roy Smith
Roy Smith added the comment: We need to define the scope of what input strings will be accepted. ISO-8601 defines a lot of stuff which we may not wish to accept. Do we want to accept both basic format (MMDD) and extended format (-MM-DD)? Do we want to accept things like "1985-W15-5",

[issue15873] "datetime" cannot parse ISO 8601 dates and times

2012-09-08 Thread Chris Rebert
Changes by Chris Rebert : -- nosy: +cvrebert ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python

[issue15873] "datetime" cannot parse ISO 8601 dates and times

2012-09-06 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: I am attaching a quick python only prototype for the proposed feature. My goal is to make date/time objects behave like numeric types for which constructors accept strings produced by str(). Since str() format is ISO 8601, it is natural to accept ISO 8

[issue15873] "datetime" cannot parse ISO 8601 dates and times

2012-09-06 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: On Thu, Sep 6, 2012 at 9:51 PM, John Nagle wrote: > It's not in Python 2.7 / Win32. Python 2.x series is closed and cannot accept new features. Both %z and fixed offset tzinfo subclass are implemented in 3.2. --

[issue15873] "datetime" cannot parse ISO 8601 dates and times

2012-09-06 Thread John Nagle
John Nagle added the comment: Re: "%z format is supported". That's platform-specific; the actual parsing is delegated to the C library. It's not in Python 2.7 / Win32: ValueError: 'z' is a bad directive in format '%Y-%m-%dT%H:%M:%S%z' It really shouldn't be platform-specific; the underlyin

[issue15873] "datetime" cannot parse ISO 8601 dates and times

2012-09-06 Thread Arfrever Frehtes Taifersar Arahesis
Changes by Arfrever Frehtes Taifersar Arahesis : -- nosy: +Arfrever ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscri

[issue15873] "datetime" cannot parse ISO 8601 dates and times

2012-09-06 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: %z format is supported, but it cannot accept colon in TZ offset. It can parse offsets like -0600 just fine. What OP is looking for is the GNU date %:z format which datetime does not support. For ISO 8601 compliance, however I think we need a way to sp

[issue15873] "datetime" cannot parse ISO 8601 dates and times

2012-09-06 Thread R. David Murray
Changes by R. David Murray : -- nosy: +r.david.murray ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://ma

[issue15873] "datetime" cannot parse ISO 8601 dates and times

2012-09-06 Thread R. David Murray
Changes by R. David Murray : -- versions: -Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3 ___ Python tracker ___ ___ Pyth

[issue15873] "datetime" cannot parse ISO 8601 dates and times

2012-09-06 Thread STINNER Victor
Changes by STINNER Victor : -- nosy: +belopolsky ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.py

[issue15873] "datetime" cannot parse ISO 8601 dates and times

2012-09-06 Thread John Nagle
New submission from John Nagle: The datetime module has support for output to a string of dates and times in ISO 8601 format ("2012-09-09T18:00:00-07:00"), with the object method "isoformat([sep])". But there's no support for parsing such strings. A string to datetime class method should be