Skip to content

Instantly share code, notes, and snippets.

@brettfreer
Last active May 24, 2016 06:30
Show Gist options
  • Save brettfreer/6543bbff74647a9bf1cdf82fad748d4f to your computer and use it in GitHub Desktop.
Save brettfreer/6543bbff74647a9bf1cdf82fad748d4f to your computer and use it in GitHub Desktop.
Return last day of month
import datetime
import calendar
def last_day_of_month(d):
return datetime.datetime(d.year, d.month, calendar.mdays[d.month]).date()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment