def floored_twelfth_of_a_year(date):
 timetuple = date.timetuple()
 year = timetuple.tm_year
 day_of_year = timetuple.tm_yday
 month0 = floor(((day_of_year / ((isleap(year) and 366.0) or 365.0)) * 12))
 return ((((year - start_year) * 12) + month0) - start_month_0_indexed)

def floored_twelfth_of_a_year ( date ) : timetuple = date . timetuple ( ) year = timetuple . tm_year day_of_year = timetuple . tm_yday month0 = floor ( ( ( day_of_year / ( ( isleap ( year ) and 366.0 ) or 365.0 ) ) * 12 ) ) return ( ( ( ( year - start_year ) * 12 ) + month0 ) - start_month_0_indexed )
this function converts a date to a month number by flooring to the nearest 12th of a year .