Day of the week: Difference between revisions
Content added Content deleted
No edit summary |
(→{{header|Vedit macro language}}: Simplified by using built-in function JDate()) |
||
Line 873: | Line 873: | ||
<lang vedit> |
<lang vedit> |
||
Buf_Switch(Buf_Free) |
Buf_Switch(Buf_Free) |
||
#1 = 25; #2 = 12 |
|||
for (#3 = 2008; #3 < 2122; #3++) { |
for (#3 = 2008; #3 < 2122; #3++) { |
||
Reg_Set(10, "12/25/") |
|||
Num_Str(#3, 10, LEFT+APPEND) |
|||
if (JDate(@10) % 7 == 0) { |
|||
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 |
|||
⚫ | |||
} |
|||
#4 = #13 % 100 |
|||
#5 = #13 / 100 |
|||
#7 = (#1 + (#12+1)*26/10 + #4 + #4/4 + #5/4 + #5*5) % 7 |
|||
Return |
|||
</lang> |
</lang> |
||