examples/sys/converting_string_to_datetime.py
from __future__ import print_function
import datetime

d = "2012-12-19"
some_day = datetime.datetime.strptime(d, '%Y-%m-%d')
print(some_day)         # 2012-12-19
print(type(some_day))   # <type 'datetime.datetime'>

t = "2013-11-04T11:23:45"
some_time = datetime.datetime.strptime(t, '%Y-%m-%dT%H:%M:%S')
print(type(some_time))  # <type 'datetime.date'>
print(some_time)        # 2013-11-04
print(some_time.minute) # 23