Template:Weekday in month
From HandWiki
Revision as of 18:35, 18 January 2018 by imported>Primefac (Protected "Template:Weekday in month": semi-protection of high-usage templates to combat systematic vandalism ([Edit=Require autoconfirmed or confirmed access] (indefinite) [Move=Require autoconfirmed or confirmed access] (indefinite)))
Usage
- Code
Note that the order of the input can be reversed. The following give the same output.
{{Weekday in month|
y|
m|
w|
n}}
{{Weekday in month|
n|
w|
m|
y}}
Note that the year is optional. The following give the nth w-day of month m this year.
{{Weekday in month||
m|
w|
n}}
{{Weekday in month|
n|
w|
m}}
- Parameters
y | year | numeric format, certain words, blank
|
---|---|---|
m | month | numeric format, spelt out in full or abbreviated
|
w | weekday | numeric format, spelt out in full or abbreviated
|
n | count | numeric format, spelt out in full or abbreviated
|
- Examples
|
|
|
Calculation
The template then gives j, the day of the month, as calculated by the following formulae.
- j = 7×n − 6 + (w − w1) mod 7 (for positive n)
- j = t + 7×(n + 1) − (wt − w) mod 7 (for negative n)
Where t is the last day of the month, wt is the ISO weekday number of the last day of the month, w1 is the ISO weekday number of the first day of the month and n and w are as defined above.
Examples
See also
- {{WEEKDAY}}
- {{Weekday in month elapsed}}