Long year: Difference between revisions
Content added Content deleted
Not a robot (talk | contribs) (Add Cowgol) |
Walterpachl (talk | contribs) (→{{header|REXX}}: refurbished) |
||
Line 2,405: | Line 2,405: | ||
=={{header|REXX}}== |
=={{header|REXX}}== |
||
<syntaxhighlight lang="rexx">/*REXX program determines |
<syntaxhighlight lang="rexx">/*REXX program determines If a (calendar) year is a short or long year */ |
||
/* (52 or 53 weeks). */ |
|||
⚫ | |||
⚫ | |||
current=left(date('S'),4) |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
Do yr=lo To hi /* process single yr or range of */ |
|||
Say ' year ' yr ' is a ', |
|||
right(word('short long',is_long(yr)+1),5) ' year' |
|||
end /*j*/ |
|||
End |
|||
⚫ | |||
Exit |
|||
/*──────────────────────────────────────────────────────────────────────────────────────*/ |
|||
/*----------------------------------------------------------------------*/ |
|||
pWeek: parse arg #; return (# + # % 4 - # % 100 + # % 400) // 7 |
|||
wd_1231: |
|||
weeks: parse arg y; if pWeek(y)==4 | pWeek(y-1)==3 then return 53; return 52</syntaxhighlight> |
|||
/************************************************************************* |
|||
* returns the day of the week of 31 December year |
|||
*************************************************************************/ |
|||
Parse Arg year |
|||
Return (year+year%4-year%100+year%400)//7 |
|||
is_long: |
|||
Parse Arg year |
|||
Return wd_1231(year)==4 |, /* year ends in a Thursday */ |
|||
wd_1231(year-1)==3 /* or previous year ends in a Wednesday */</syntaxhighlight> |
|||
{{out|output|text= when using the inputs of: <tt> 1990 2030 </tt>}} |
{{out|output|text= when using the inputs of: <tt> 1990 2030 </tt>}} |
||