Created
January 4, 2012 16:15
-
-
Save vgoklani/1560746 to your computer and use it in GitHub Desktop.
Parse date in Python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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