Skip to content

Instantly share code, notes, and snippets.

@nmarley
Created March 21, 2017 15:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nmarley/4ee2b35c317cd58b95f56a2574f41bbd to your computer and use it in GitHub Desktop.
Save nmarley/4ee2b35c317cd58b95f56a2574f41bbd to your computer and use it in GitHub Desktop.
Python date range from a starting date to today
import datetime
import sys
from pprint import pprint
today = datetime.datetime.today().date()
start = datetime.datetime(2011, 2, 12, 0, 0, 0, tzinfo=None)
next_day = start
while next_day.date() <= today:
pprint(next_day.date())
next_day = next_day + datetime.timedelta(days=1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment