datetime iso8601 string input

Rubic rubic88 at gmail.com
Fri Feb 24 08:07:19 EST 2006


Magnus,

Thanks for your reply.  I wasn't clear in my
prior post.  Rather than support the entire
range of iso8601 formats, how about *just* the
format that datetime emits?  Call it the
parse_datetime() function.  Then it would be
possible to take the output string of a datetime
object and read it back in to round-trip the
data.

    >>> now = str(datetime.datetime.now())
    >>> now
    '2006-02-24 06:58:23.737586'
    >>> datetime.parse_datetime(now)
    datetime.datetime(2006, 2, 24, 6, 58, 23, 737586)

Jeff Bauer
Rubicon, Inc.




More information about the Python-list mailing list