Calculate dates for at year

This commit is contained in:
Rolf Amfelt 2024-04-14 16:29:36 +02:00
parent 19852867df
commit ef1e916b8a

13
datoer.py Normal file
View file

@ -0,0 +1,13 @@
import sys
import calendar
year = 2024
if len(sys.argv) > 1:
try:
year = int(sys.argv[-1])
except ValueError:
pass
for month in range(1, 13):
last_sunday = max(week[-1] for week in calendar.monthcalendar(year, month))
print('{}-{}-{:2}'.format(year, calendar.month_abbr[month], last_sunday))