Day of the week: Difference between revisions

Content added Content deleted
No edit summary
(Vedit macro language added)
Line 815: Line 815:


(Output same as UNIX Shell)
(Output same as UNIX Shell)

=={{header|Vedit macro language}}==
<lang vedit>
Buf_Switch(Buf_Free)
#1 = 25; #2 = 12
for (#3 = 2008; #3 < 2122; #3++) {
Call("WEEKDAY")
if (#7 == 1) { Num_Ins(#3, NOCR) }
}
Return

/////////////////////////////////////////////////////////////
//
// Calculate weekday using Zeller's congruence
// #1 = day, #2 = month, #3 = year
// On return: #7 = weekday (0 = Sat ... 6 = Fri)
//
:WEEKDAY:
#12 = #2 // month tmp
#13 = #3 // year tmp
if (#12 < 3) {
#12 += 12
#13--
}
#4 = #13 % 100
#5 = #13 / 100
#7 = (#1 + (#12+1)*26/10 + #4 + #4/4 + #5/4 - #5*2) % 7
Return
</lang>

Output:
<pre>
2011 2016 2022 2033 2039 2044 2050 2061 2067 2072 2078 2089 2095 2101 2107 2112 2118
</pre>