Skip to content

Instantly share code, notes, and snippets.

@mdbraber
Created August 20, 2019 20:25
Show Gist options
  • Save mdbraber/220326082b7a9a03f7be06356fde77dc to your computer and use it in GitHub Desktop.
Save mdbraber/220326082b7a9a03f7be06356fde77dc to your computer and use it in GitHub Desktop.
A quick hack to output a 12-week year calendar (well actually, 13 weeks per quarter) - can be directly copied to Workflowy
from datetime import datetime
import locale
locale.setlocale(locale.LC_TIME, "nl_NL")
year = "2019"
for q in range (1,5):
qfirst = datetime.strptime(f"{year}-W{((q-1)*13)}-1", "%Y-W%W-%w").strftime("%a %d %b").capitalize()
qlast = datetime.strptime(f"{year}-W{((q-1)*13+12)}-0", "%Y-W%W-%w").strftime("%a %d %b").capitalize()
print(f"{year} Q{q}: {qfirst} - {qlast} {year}")
print("\n\"Goals:\" \n")
for w in range(1,14):
week_number = (q-1)*13+w
ds = f"{year}-W{(week_number-1):02d}"
monday = datetime.strptime(ds+"-1", "%Y-W%W-%w").strftime("%a %d").capitalize()
sunday = datetime.strptime(ds+"-0", "%Y-W%W-%w").strftime("%a %d").capitalize()
month = datetime.strptime(ds+"-0", "%Y-W%W-%w").strftime("%b")
year = datetime.strptime(ds+"-0", "%Y-W%W-%w").strftime("%Y")
print(f"\t- Week {week_number:02d}: {monday} - {sunday} {month} {year} (Q{q} week {w:d}/13) #week{week_number:02d} #q{q} #{year}")
for day in [1,2,3,4,5,6,0]:
print("\t\t- " + datetime.strptime(ds+"-"+str(day), "%Y-W%W-%w").strftime("%a %d %b #%Y").capitalize() + " #week"+str(week_number))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment