Last active
June 20, 2020 14:49
-
-
Save surgicalmaskman/38dce23374fa3c27e69e84bde18d7e54 to your computer and use it in GitHub Desktop.
random date generator for planned annual vacation request
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 random | |
def jdn1(): | |
return datetime.datetime(datetime.date.today().year,4,1).toordinal() | |
def jdn12(): | |
return datetime.datetime(datetime.date.today().year+1,3,31).toordinal() | |
x= [1]*10 | |
for i in range(10): | |
x[i]= (random.randint(jdn1(),jdn12())) | |
if datetime.date.fromordinal(x[i]).isoweekday()== 7: | |
x.pop() | |
x.sort() | |
iso= [] | |
for i in range(10): | |
iso= datetime.date.fromordinal(x[i]) | |
print(iso.strftime("%F %a")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment