Skip to content

Parse time formats better #4

@GoogleCodeExporter

Description

@GoogleCodeExporter
Some gpx files use the time format <time>2010-07-18T15:21:41+01:00</time> which 
breaks your script at the moment.

You might consider using the parser from the python dateutil module which will 
handle virtually any time format. 

e.g.:

from dateutil import parser

def prettify_time(time):
    time = parser.parse(time)
    if tzname:
        time=time.replace(tzinfo=pytz.utc)
        time=time.astimezone(pytz.timezone(tzname))
    return time

Original issue reported on code.google.com by mark.opu...@googlemail.com on 23 Jul 2010 at 5:13

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions