Skip to content

Parse time formats better #4

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions