Day of Week Calendar
The standard format used in printed calendars now is to make it easy to read the days of the month given the month and the day of the week. This format is familiar enough that most of us can quickly locate the day number in the rectangle for the month, and look up to read the name of the weekday. It is possible to use a different format, where each month is represented by a single line in which the names of the days are displayed. One locates the day of the month in a block at the top where the numbers 1-31 are shown, then moves down to the row for the month and reads off the weekday. Here is a program to print the modified calendar for a specified year.
program calendar
IMPLICIT NONE
character(2)::dnam(7)=["Su","Mo","Tu","We","Th","Fr","Sa"]
character(3)::mnam(12)=["Jan","Feb","Mar","Apr", &
"May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]
integer :: dno,mon,y,d,i
integer :: cdm(12)=[31,28,31,30,31,30,31,31,30,31,30,31]!days in month, cmn year
integer :: ldm(12)=[31,29,31,30,31,30,31,31,30,31,30,31]!days in month, leap year
read *,y
10 format(A8,i4,': ',i2,a3)
dno = dow(y,7,4)
print *,'Year ',y,' key: ',dnam(dno)
print *,'d: 1 2 3 4 5 6 7'
print *,' 8 9 10 11 12 13 14'
print *,' 15 16 17 18 19 20 21'
print *,' 22 23 24 25 26 27 28'
print *,' 29 30 31'
do mon=1,12
write(*,'(/A3,4x)',advance='no') mnam(mon)
do i = 1,7
d=dow(y,mon,i)
write (*,'(A4)',advance='no') dnam(d)
end do
end do
stop
contains
integer function dow(y,m,d)
integer, intent(in)::y,m,d
integer :: yy,cc,v,dm,e2
integer :: mc(12)=[3,0,0,4,2,6,4,1,5,3,0,5] !first dmsd of month,cmnY J.Conway
integer :: ml(12)=[4,1,0,4,2,6,4,1,5,3,0,5] !first dmsd of month, leapY J.Conway
logical :: leap
cc=int(y/100)
yy=mod(y,100)
if(yy.eq.0)then
leap=mod(y,400).eq.0
else
leap=mod(y,4).eq.0
endif
e2=mod(cc,4)+mod(yy,4)-1; dm=mod(5*e2+10*yy,7) !Nakai formula for doomsday of year
if(leap)then
v=d - ml(m) + dm
else
v=d - mc(m) + dm
endif
dow=mod(max(v,v+7),7)+1
return
end function dow
end program calendar
! The day was Monday on January 0001 AD
Here is the output calendar for 2026:
Year 2026 key: Sa
d: 1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31
Jan Th Fr Sa Su Mo Tu We
Feb Su Mo Tu We Th Fr Sa
Mar Su Mo Tu We Th Fr Sa
Apr We Th Fr Sa Su Mo Tu
May Fr Sa Su Mo Tu We Th
Jun Mo Tu We Th Fr Sa Su
Jul We Th Fr Sa Su Mo Tu
Aug Sa Su Mo Tu We Th Fr
Sep Tu We Th Fr Sa Su Mo
Oct Th Fr Sa Su Mo Tu We
Nov Su Mo Tu We Th Fr Sa
Dec Tu We Th Fr Sa Su Mo
and, for the leap year 2028:
Year 2028 key: Tu
d: 1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31
Jan Sa Su Mo Tu We Th Fr
Feb Tu We Th Fr Sa Su Mo
Mar We Th Fr Sa Su Mo Tu
Apr Sa Su Mo Tu We Th Fr
May Mo Tu We Th Fr Sa Su
Jun Th Fr Sa Su Mo Tu We
Jul Sa Su Mo Tu We Th Fr
Aug Tu We Th Fr Sa Su Mo
Sep Fr Sa Su Mo Tu We Th
Oct Su Mo Tu We Th Fr Sa
Nov We Th Fr Sa Su Mo Tu
Dec Fr Sa Su Mo Tu We Th
The user of this has to make sure that the day being looked up is correct; for instance, April 31 or February 30 are invalid.
The key day of the year is displayed for use in mentally calculating the weekday using mnemonics such as John Conway's "doomsday method".
Please try the two sample calendars above and provide your critical comments on the usefulness of the alternative format.
I like the efficiency and am sure with a bit of practice I could get used to it. I use the doomsday method - remembering the key day always seems the most difficult!
Thanks, Robert, for your comments and your critical evaluation of the format.
A comment on finding the doomsday : Nakai's formula, used in the Fortran code, is easy to use for mental calculation.
Let cc be the two digit century, and yy the two digit year. Evaluate c=mod(cc,4), y=mod(yy,4) and let e2=c+y-1. The doomsday number is dm=mod( 5 e2+10 yy ,7), and dm values 0..6 correspond to Sunday .. Saturday.
For 2026, cc=20, yy=26, so c=0, y=2, e2=1, dm=mod(5+260,7)=6, so the doomsday for the current year (2026) is Saturday.
The USA and India celebrate their Independence days on doomsday!
What strikes me with this calendar layout is how easy it is to identify the months on which the 13th falls on a Friday. Three (the max. possible in one year) in 2026 (Feb, Mar, and Nov), and only one (the min. possible in one year) in 2028 (October).
I must be superstitious!
Kenneth,
Thanks for your comments.
The one line/month format makes it easy to see that, in 2027, Feb, Mar and Nov have identical lines; also, in 2027, Jan=Oct, Apr=Jul and Sep=Dec. In 2028, Jan=Apr=Jul, Feb=Aug and Sep = Dec ('=' signifying 'have identical lines')
Curiously, in Italy, it is Friday 17 that is supposed to bring bad luck.
I deal quite a bit with plastic ID cards so wondered what your calendar would look like on one:
It is quite usable. A 'full' calendar at that size would be tricky to read.
There is enough space remaining at the end to accommodate a logo and contact information/ address.
