Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #28633
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <d@davea.name> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'wiki': 0.03; 'output': 0.04; 'dependency': 0.07; 'python': 0.09; 'likewise': 0.09; 'mentions': 0.09; 'objects.': 0.09; 'output,': 0.09; 'cc:addr :python-list': 0.10; '2.7': 0.13; "hasn't": 0.15; '"working': 0.16; '2.7:': 0.16; "isn't.": 0.16; 'parser.': 0.16; 'subject:ISO': 0.16; 'subject:parser': 0.16; 'subject:where': 0.16; 'time"': 0.16; 'wrote:': 0.17; 'input': 0.18; 'module': 0.19; 'parse': 0.22; "i'd": 0.22; 'cc:2**0': 0.23; 'cc:no real name:2**0': 0.24; 'so.': 0.24; 'cc:addr:python.org': 0.25; 'header :In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'looks': 0.26; 'skip:" 20': 0.26; "doesn't": 0.28; 'subject:/': 0.28; 'issues.': 0.29; 'url:python': 0.32; 'says': 0.33; 'dates': 0.33; 'point,': 0.33; 'skip:d 20': 0.34; 'updated': 0.34; 'third': 0.34; 'moved': 0.35; 'outstanding': 0.35; 'pm,': 0.35; 'subject:?': 0.35; 'there': 0.35; 'but': 0.36; 'url:org': 0.36; 'url:library': 0.36; 'method': 0.36; 'subject:: ': 0.38; 'object': 0.38; 'some': 0.38; 'url:docs': 0.38; 'received:192': 0.39; 'skip:" 10': 0.40; 'received:192.168': 0.40; 'easy': 0.60; 'john': 0.60; 'header :Reply-To:1': 0.68; 'received:74.208': 0.71; 'reply-to:no real name:2**0': 0.72 |
| Date | Thu, 06 Sep 2012 15:54:15 -0400 |
| From | Dave Angel <d@davea.name> |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0 |
| MIME-Version | 1.0 |
| To | John Nagle <nagle@animats.com> |
| Subject | Re: Parsing ISO date/time strings - where did the parser go? |
| References | <k2atej$4rq$1@dont-email.me> |
| In-Reply-To | <k2atej$4rq$1@dont-email.me> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | 7bit |
| X-Provags-ID | V02:K0:ea/cXh8ZRJg/fVsCEaw6U9dt31shwqhOQhmnkKnBQTR VdjVaBQuR8S7yNZzxSW9urOLss7JKw5LuAHuztWC8VkXWk6HVa ekSLmyEJUk+CaB+upKNL20Xrxqd4IyDBKSO0cEYTk0EYgAXpLO lDrjO16ePNPpX4hMQpEDMIWxAUt38HQJ4A5mA9apBYC4JxBhZn SPgHlq99u1h+teZuhMC6aIj1aH3+MnHflbQnJvP0E9f4qgGdsv ZGnm8V5urOy7TX3TYt2q7iIrZetapVuF8Ws5IIM33GEvNMXFB/ kMN7tBqpdCWjUZxYhNj04HygZg4cePZtk6x60x1MW+ZPV52jA= = |
| Cc | python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| Reply-To | d@davea.name |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.325.1346961282.27098.python-list@python.org> (permalink) |
| Lines | 51 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1346961282 news.xs4all.nl 6885 [2001:888:2000:d::a6]:39486 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:28633 |
Show key headers only | View raw
On 09/06/2012 03: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)
>
> 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".
>
For working with datetime, see
http://docs.python.org/library/datetime.html#datetime.datetime
and look up datetime.strptime()
Likewise for generalized output, check out datetime.strftime().
--
DaveA
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