Created
May 14, 2016 19:00
-
-
Save jorotenev/0048a55e47c194b32e3dc97d209b0148 to your computer and use it in GitHub Desktop.
Snippet to print all dates, given some boundaries
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 | |
# m/d/y | |
StartDate = "2/12/16" | |
EndDate = "5/13/16" | |
date = datetime.datetime.strptime(StartDate, "%m/%d/%y") | |
dates = [date] | |
endDate = datetime.datetime.strptime(EndDate, "%m/%d/%y") | |
while date < endDate: | |
date = date + datetime.timedelta(days=7) | |
dates.append(date) | |
for d in dates: | |
print(d.strftime('%d-%m-%Y')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment