# pip install python-dateutil from dateutil import parser ds = '2012-03-01T10:00:00Z' # or any date sting of differing formats. date = parser.parse(ds)