input date month year python code example
Example 1: python input date
date = input("Enter date in YYYY-MM-DD format")
year, month, day = map(int, date.split('-'))
date = datetime.date(year, month, day)
Example 2: date.month date time
import datetime
dt = datetime.datetime.today()
print dt.year
# Output: 2016
print dt.month
# Output: 8
print dt.day
# Output: 22