datetime iso8601 string input

skip at pobox.com skip at pobox.com
Tue Mar 21 12:32:24 EST 2006


    aurora> I agree. I just keep rewriting the parse method again and again.

    aurora> def parse_iso8601_date(s):
    aurora>      """ Parse date in iso8601 format e.g. 2003-09-15T10:34:54 and
    aurora>          returns a datetime object.
    aurora>      """
    ...

Why not

    dt = datetime.datetime(*time.strptime(s, "%Y-%m-%dT%H:%M:%S")[0:6])

?

Skip



More information about the Python-list mailing list