The datetime class does not directly support parsing formatted time strings. You can use time.strptime to do the parsing and create a datetime object from the tuple it returns:
>>> s = "2005-12-06T12:13:14" >>> from datetime import datetime >>> from time import strptime >>> datetime(*strptime(s, "%Y-%m-%dT%H:%M:%S")[0:6]) datetime.datetime(2005, 12, 6, 12, 13, 14)