Is there a way using Python\'s standard library to easily determine (i.e. one function call) the last day of a given month?
If the standard library doesn\'t support
For me it's the simplest way:
selected_date = date(some_year, some_month, some_day)
if selected_date.month == 12: # December
last_day_selected_month = date(selected_date.year, selected_date.month, 31)
else:
last_day_selected_month = date(selected_date.year, selected_date.month + 1, 1) - timedelta(days=1)