Skip to content

Instantly share code, notes, and snippets.

View hiepnsx's full-sized avatar

シン・ヒェップ hiepnsx

  • VERVE INC
  • 東京
View GitHub Profile
@tcg
tcg / get_month_day_range.py
Created January 18, 2016 19:09
Get first and last day of a particular month, in Python, with no requirements outside of Python's standard library. From: https://gist.github.com/waynemoore/1109153#gistcomment-1193720
import datetime
import calendar
def get_month_day_range(date):
"""
For a date 'date' returns the start and end date for the month of 'date'.
Month with 31 days:
>>> date = datetime.date(2011, 7, 27)
>>> get_month_day_range(date)