Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #28632
| Date | 2012-09-06 21:44 +0200 |
|---|---|
| From | Thomas Jollans <t@jollybox.de> |
| Subject | Re: Parsing ISO date/time strings - where did the parser go? |
| References | <k2atej$4rq$1@dont-email.me> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.323.1346961101.27098.python-list@python.org> (permalink) |
On 09/06/2012 09:27 PM, John Nagle wrote: > In Python 2.7: > > I want to parse standard ISO date/time strings such as > > 2012-09-09T18:00:00-07:00 > > into Python "datetime" objects. The "datetime" object offers > an output method , datetimeobj.isoformat(), but not an input > parser. There ought to be > > classmethod datetime.fromisoformat(s) http://docs.python.org/library/datetime.html#datetime.datetime.strptime The ISO date/time format is dead simple and well-defined. strptime is quite suitable. > > but there isn't. I'd like to avoid adding a dependency on > a third party module like "dateutil". > > The "Working with time" section of the Python wiki is so > ancient it predates "datetime", and says so. > > There's an iso8601 module on PyPi, but it's abandoned; it hasn't been > updated since 2007 and has many outstanding issues. > > There are mentions of "xml.utils.iso8601.parse" in > various places, but the "xml" module that comes > with Python 2.7 doesn't have xml.utils. > > http://www.seehuhn.de/pages/pdate > says: > > "Unfortunately there is no easy way to parse full ISO 8601 dates using > the Python standard library." > > It looks like this was taken out of "xml" at some point, > but not moved into "datetime". > > John Nagle >
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Parsing ISO date/time strings - where did the parser go? John Nagle <nagle@animats.com> - 2012-09-06 12:27 -0700
Re: Parsing ISO date/time strings - where did the parser go? Paul Rubin <no.email@nospam.invalid> - 2012-09-06 12:51 -0700
Re: Parsing ISO date/time strings - where did the parser go? John Nagle <nagle@animats.com> - 2012-09-06 13:34 -0700
Re: Parsing ISO date/time strings - where did the parser go? Miki Tebeka <miki.tebeka@gmail.com> - 2012-09-06 16:27 -0700
Re: Parsing ISO date/time strings - where did the parser go? John Gleeson <jdgleeson@mac.com> - 2012-09-08 18:20 -0600
Re: Parsing ISO date/time strings - where did the parser go? John Nagle <nagle@animats.com> - 2012-09-08 20:51 -0700
Re: Parsing ISO date/time strings - where did the parser go? Roy Smith <roy@panix.com> - 2012-09-09 06:15 -0400
Re: Parsing ISO date/time strings - where did the parser go? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-09-09 12:20 +0100
Re: Parsing ISO date/time strings - where did the parser go? Thomas Jollans <t@jollybox.de> - 2012-09-06 21:44 +0200
Re: Parsing ISO date/time strings - where did the parser go? Roy Smith <roy@panix.com> - 2012-09-09 08:14 -0400
Re: Parsing ISO date/time strings - where did the parser go? "Rhodri James" <rhodri@wildebst.demon.co.uk> - 2012-09-10 22:46 +0100
Re: Parsing ISO date/time strings - where did the parser go? Chris Angelico <rosuav@gmail.com> - 2012-09-11 08:51 +1000
Re: Parsing ISO date/time strings - where did the parser go? Roy Smith <roy@panix.com> - 2012-09-10 21:12 -0400
Re: Parsing ISO date/time strings - where did the parser go? Ben Finney <ben+python@benfinney.id.au> - 2012-09-12 02:00 +1000
Re: Parsing ISO date/time strings - where did the parser go? Dave Angel <d@davea.name> - 2012-09-06 15:54 -0400
Re: Parsing ISO date/time strings - where did the parser go? Roy Smith <roy@panix.com> - 2012-09-06 19:44 -0400
Re: Parsing ISO date/time strings - where did the parser go? André Malo <ndparker@gmail.com> - 2012-09-08 20:12 +0200
Re: Parsing ISO date/time strings - where did the parser go? Roy Smith <roy@panix.com> - 2012-09-06 19:34 -0400
Re: Parsing ISO date/time strings - where did the parser go? Terry Reedy <tjreedy@udel.edu> - 2012-09-06 22:12 -0400
Re: Parsing ISO date/time strings - where did the parser go? Pete Forman <petef4+usenet@gmail.com> - 2012-09-12 13:31 +0100
csiph-web