Created
March 21, 2017 15:36
-
-
Save nmarley/4ee2b35c317cd58b95f56a2574f41bbd to your computer and use it in GitHub Desktop.
Python date range from a starting date to today
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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