Skip to content Skip to sidebar Skip to footer

How To Convert The Following String To Python Date?

How can I convert: u'2012-11-07T13:25:10.703Z' to Python datetime? EDIT I intend to use something like this: >>> from datetime import datetime >>> datetime.strpt

Solution 1:

Use strptime from the datetime module

import datetime
datetime.strptime(u'2012-11-07T13:25:10.703Z', '%Y-%m-%dT%H:%M:%S.%fZ')
>>> datetime.datetime(2012, 11, 7, 13, 25, 10, 703000)

Post a Comment for "How To Convert The Following String To Python Date?"