Skip to content


Python: Parsen von Timestrings mit Timezoneinfo

Schon öfter hab ich danach gesucht jetzt schreib ichs mal auf. Wie parset man in Python einen Timestring der so aussieht:

Tue, 14 Jul 2009 10:20:20 +0200

Ganz einfach – mit dem Modul dateutil:

>>> from dateutil.parser import parse
>>> d = parse(‘Tue, 14 Jul 2009 10:20:20 +0200′);
>>> d
datetime.datetime(2009, 7, 14, 10, 20, 20, tzinfo=tzoffset(None, 7200))

  • Share/Bookmark

No related posts.

Posted in Code & Snippets.


0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.

You can add images to your comment by clicking here.

Security Code: