last_twelve_months = dt.datetime.strptime(latest_date, '%Y-%m-%d') - dt.timedelta(days=365) code example
Example: 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