Skip to content

Instantly share code, notes, and snippets.

@maxpoletaev
Created December 1, 2014 15:06
Show Gist options
  • Save maxpoletaev/8ace926cdcd1c77da097 to your computer and use it in GitHub Desktop.
Save maxpoletaev/8ace926cdcd1c77da097 to your computer and use it in GitHub Desktop.
Month day range
import calendar
def month_day_range(date):
first_day = date.replace(day = 1)
last_day = date.replace(day = calendar.monthrange(date.year, date.month)[1])
return first_day, last_day
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment