Skip to content

Instantly share code, notes, and snippets.

@vgoklani
Created January 4, 2012 16:15
Show Gist options
  • Save vgoklani/1560746 to your computer and use it in GitHub Desktop.
Save vgoklani/1560746 to your computer and use it in GitHub Desktop.
Parse date in Python
import dateutil.parser
d1 = '2008-09-03T20:56:35.450686Z'
d2 = dateutil.parser.parse(d1)
d3 = d2.astimezone(dateutil.tz.tzutc())
s = 'Fri, 09 Dec 2011 13:50:20 +0000'
import dateutil.parser
d = dateutil.parser.parse(s)
>>> d
datetime.datetime(2011, 12, 9, 13, 50, 20, tzinfo=tzutc())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment