python date.year code example
Example 1: 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
Example 2: datetime year python
import datetime
now = datetime.datetime.now()
print(now.year, now.month, now.day, now.hour, now.minute, now.second)