Created
June 18, 2021 11:47
-
-
Save tripleo1/a5678951729f7379fd48d989cc4c9acf to your computer and use it in GitHub Desktop.
Calculate every interval of days between 2 dates.
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 | |
year = int(sys.argv[1]) | |
def calculate(year): | |
dt1 = datetime.datetime(year, 1, 1) | |
yield ("A", dt1) | |
dt2 = datetime.timedelta(days=14) | |
for i in range(25): | |
yield (chr(66+i),dt1+dt2) | |
dt1=dt1+dt2 | |
for letter, date in calculate(year): | |
real_date = date.strftime("%Y %b %d") | |
print (letter, real_date) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment