Template:Weekday in month
Appearance
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 | spelt out in full or abbreviated (preferred)
or numeric format (discouraged)
|
| n | count | numeric format, spelt out in full or abbreviated
|
Examples
- for the first Sunday of January 2000
- n =
first,1stor1 - w =
SundayorSun(or0) - m =
January,Janor1 - y =
2000
- n =
- for the first Monday of February 2006
- n =
first,1stor1 - w =
MondayorMon(or1) - m =
February,Febor2 - y =
2006
- n =
- for the first Tuesday of March 2010
- n =
first,1stor1 - w =
TuesdayorTue(or2) - m =
March,Maror3 - y =
2010
- n =
- for the second Tuesday of April 2012
- n =
second,2ndor2 - w =
TuesdayorTue(or2) - m =
April,Apror4 - y =
2012
- n =
- for the second Tuesday of May 2020
- n =
second,2ndor2 - w =
TuesdayorTue(or2) - m =
Mayor5 - y =
2020
- n =
- for the second Wednesday of June 2100
- n =
second,2ndor2 - w =
WednesdayorWed(or3) - m =
June,Junor6 - y =
2100
- n =
- for the third Wednesday of July this year
- n =
third,3rdor3 - w =
WednesdayorWed(or3) - m =
July,Julor7 - y =
{{#time:Y}},{{CURRENTYEAR}}or leave it blank
- n =
- for the third Thursday of August this year
- n =
third,3rdor3 - w =
ThursdayorThu(or4) - m =
August,Augor8 - y =
{{#time:Y}},{{CURRENTYEAR}}or leave it blank
- n =
- for the last Thursday of September last year
- n =
lastor-1 - w =
ThursdayorThu(or4) - m =
September,Sepor9 - y =
{{#time:Y|last year}},{{LASTYEAR}}orlast year
- n =
- for the last Friday of October last year
- n =
lastor-1 - w =
FridayorFri(or5) - m =
October,Octor10 - y =
{{#time:Y|last year}},{{LASTYEAR}}orlast year
- n =
- for the second last Friday of November next year
- n =
second last,2nd lastor-2 - w =
FridayorFri(or5) - m =
November,Novor11 - y =
{{#time:Y|next year}},{{NEXTYEAR}}ornext year
- n =
- for the second last Saturday of December next year
- n =
second last,2nd lastor-2 - w =
SaturdayorSat(or6) - m =
December,Decor12 - y =
{{#time:Y|next year}},{{NEXTYEAR}}ornext year
- n =
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 non-ISO weekday number of the last day of the month, w1 is the non-ISO weekday number of the first day of the month and n and w are as defined above.
Examples
| year | MLK Jr Day (US) | Presidents Day (US) | Memorial Day (US) | Labor Day (US) | Columbus Day (US) | Father's Day (Australia) |
Mother's Day (many countries) |
Thanksgiving (Norfolk Island) |
Melbourne Cup Day (Australia) |
|---|---|---|---|---|---|---|---|---|---|
| 3rd Monday in January | 3rd Monday in February | Last Monday in May | 1st Monday in September | 2nd Monday in October | 1st Sunday in September | 2nd Sunday in May | last Wednesday of November | first Tuesday in November | |
| 2021 | 18 January | 15 February | 31 May | 6 September | 11 October | 3 September | 9 May | 24 November | 2 November |
| 2021|1 |
3|1 |
2021|5 |
first |
2nd|Mon |
1st|sun |
2|sun |
last|Wed |
1st|Tue | |
| 2022 | 17 January | 21 February | 30 May | 5 September | 10 October | 2 September | 8 May | 30 November | 1 November |
| 2022|1 |
3|1 |
2022|5 |
first |
2nd|Mon |
1st|sun |
2|sun |
last|Wed |
1st|Tue | |
| 2023 | 16 January | 20 February | 29 May | 4 September | 9 October | 1 September | 14 May | 29 November | 7 November |
| 2023|1 |
3|1 |
2023|5 |
first |
2nd|Mon |
1st|sun |
2|sun |
last|Wed |
1st|Tue | |
| 2024 | 15 January | 19 February | 27 May | 2 September | 14 October | 6 September | 12 May | 27 November | 5 November |
| 2024|1 |
3|1 |
2024|5 |
first |
2nd|Mon |
1st|sun |
2|sun |
last|Wed |
1st|Tue | |
| 2025 (last year) |
20 January | 17 February | 26 May | 1 September | 13 October | 5 September | 11 May | 26 November | 4 November |
| 2025|1 |
3|1 |
2025|5 |
first |
2nd|Mon |
1st|sun |
2|sun |
last|Wed |
1st|Tue | |
| 2026 (this year) |
19 January | 16 February | 25 May | 7 September | 12 October | 4 September | 10 May | 25 November | 3 November |
| 2026|1 |
3|1 |
2026|5 |
first |
2nd|Mon |
1st|sun |
2|sun |
last|Wed |
1st|Tue | |
| 2027 (next year) |
18 January | 15 February | 31 May | 6 September | 11 October | 3 September | 9 May | 24 November | 2 November |
| 2027|1 |
3|1 |
2027|5 |
first |
2nd|Mon |
1st|sun |
2|sun |
last|Wed |
1st|Tue |
Notes
See also
- {{WEEKDAY}}
- {{Weekday in month elapsed}}