Skip to content

Instantly share code, notes, and snippets.

@gdmachado
Created August 15, 2014 14:38
Show Gist options
  • Save gdmachado/9ae55b4c431f6e31a305 to your computer and use it in GitHub Desktop.
Save gdmachado/9ae55b4c431f6e31a305 to your computer and use it in GitHub Desktop.
def genDateRange(startDate, endDate):
dt0 = datetime.datetime.strptime(startDate, "%Y-%m-%d")
dt1 = datetime.datetime.strptime(endDate, "%Y-%m-%d")
for n in range(int ((dt1 - dt0).days) + 1):
yield (dt0 + datetime.timedelta(n)).strftime("%Y-%m-%d")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment