Day of the week: Difference between revisions
Content added Content deleted
m (→using DATE base: changed quote style.) |
m (→old school DOW: added whitespace.) |
||
Line 3,753: | Line 3,753: | ||
exit /*stick a fork in it, we're all done. */ |
exit /*stick a fork in it, we're all done. */ |
||
/*──────────────────────────────────────────────────────────────────────────────────────*/ |
/*──────────────────────────────────────────────────────────────────────────────────────*/ |
||
dow: procedure; parse arg m,d,y; |
dow: procedure; parse arg m,d,y; if m<3 then do; m= m+12; y= y-1; end |
||
yL=left(y,2); yr=right(y,2); w=(d + (m+1)*26%10+yr+yr%4+yL%4+5*yL) // |
yL= left(y, 2); yr= right(y, 2); w= (d + (m+1)*26%10 +yr +yr%4 +yL%4 +5*yL) //7 |
||
if w==0 then w=7; |
if w==0 then w= 7; return w /*Sunday=1, Monday=2, ··· Saturday=7*/</lang> |
||
{{out|output|text= when using the default input:}} |
{{out|output|text= when using the default input:}} |
||
<pre> |
<pre> |