from datetime import datetime
datestring = '2008-12-12 19:21:10'
dt = datetime.strptime(datestring, '%Y-%m-%d %H:%M:%S')
print(dt.year, dt.month, dt.day)
in Python, How can I convert a string into a date object and get year, month and day separately?