Template:WEEKDAYNUMBER
This template returns the ISO week date integer weekday number (between 1 and 7) of the date whose number is in parameter. Alternatively, the day can be given with its English weekday name (complete or abbreviated to 3 characters, with capitals or small letters).
Usage
Syntax
{{WEEKDAYNUMBER|day}}- The day value can be any numeric expression and is interpreted modulo 7 (extra leading zeroes and decimals are ignored).
- The returned value is ordered from 1 to 7 according to the ISO week (Monday to Sunday), and is consistent with date computing with ISO week or ISO year computations. Use another template to convert it to traditional US week numbers, by reducing the result with modulo 7.
Example with a Julian day timestamp
{{WEEKDAYNUMBER|{{JULIANDAY.DAYNAME|{{JULIANDAY|2000|01|01}}}}}}returns 6.{{WEEKDAYNUMBER|{{JULIANDAY.DAYNAME|{{JULIANDAY|2026|08|18}}}}}}returns 2.
Examples for all standard English week day names
{{WEEKDAYNUMBER|monday}}returns 1{{WEEKDAYNUMBER|tuesday}}returns 2{{WEEKDAYNUMBER|wednesday}}returns 3{{WEEKDAYNUMBER|thursday}}returns 4{{WEEKDAYNUMBER|friday}}returns 5{{WEEKDAYNUMBER|saturday}}returns 6{{WEEKDAYNUMBER|sunday}}returns 7
Examples for all abbreviated English week day names
{{WEEKDAYNUMBER|mon}}returns 1{{WEEKDAYNUMBER|tue}}returns 2{{WEEKDAYNUMBER|wed}}returns 3{{WEEKDAYNUMBER|thu}}returns 4{{WEEKDAYNUMBER|fri}}returns 5{{WEEKDAYNUMBER|sat}}returns 6{{WEEKDAYNUMBER|sun}}returns 7
Examples for all standard week day numbers
{{WEEKDAYNUMBER|0}}returns 7{{WEEKDAYNUMBER|1}}returns 1{{WEEKDAYNUMBER|2}}returns 2{{WEEKDAYNUMBER|3}}returns 3{{WEEKDAYNUMBER|4}}returns 4{{WEEKDAYNUMBER|5}}returns 5{{WEEKDAYNUMBER|6}}returns 6{{WEEKDAYNUMBER|7}}returns 7
Examples for week day numbers with extra leading zero
{{WEEKDAYNUMBER|00}}returns 7{{WEEKDAYNUMBER|01}}returns 1{{WEEKDAYNUMBER|02}}returns 2{{WEEKDAYNUMBER|03}}returns 3{{WEEKDAYNUMBER|04}}returns 4{{WEEKDAYNUMBER|05}}returns 5{{WEEKDAYNUMBER|06}}returns 6{{WEEKDAYNUMBER|07}}returns 7
Examples for week day number underflows and overflows, from computed values
{{WEEKDAYNUMBER|-700}}returns 7{{WEEKDAYNUMBER|-701}}returns 6{{WEEKDAYNUMBER|-707}}returns 7{{WEEKDAYNUMBER|-7}}returns 7{{WEEKDAYNUMBER|-6}}returns 1{{WEEKDAYNUMBER|-5}}returns 2{{WEEKDAYNUMBER|-4}}returns 3{{WEEKDAYNUMBER|-3}}returns 4{{WEEKDAYNUMBER|-2}}returns 5{{WEEKDAYNUMBER|-1}}returns 6{{WEEKDAYNUMBER|-0.9999}}returns 6{{WEEKDAYNUMBER|-0.5}}returns 6{{WEEKDAYNUMBER|-0.0001}}returns 6{{WEEKDAYNUMBER|0}}returns 7{{WEEKDAYNUMBER|0.0001}}returns 7{{WEEKDAYNUMBER|0.5}}returns 7{{WEEKDAYNUMBER|0.9999}}returns 7{{WEEKDAYNUMBER|6.0001}}returns 6{{WEEKDAYNUMBER|6.5}}returns 6{{WEEKDAYNUMBER|6.9999}}returns 6{{WEEKDAYNUMBER|7}}returns 7{{WEEKDAYNUMBER|8}}returns 1{{WEEKDAYNUMBER|14}}returns 7{{WEEKDAYNUMBER|700}}returns 7{{WEEKDAYNUMBER|701}}returns 1{{WEEKDAYNUMBER|707}}returns 7
Example for invalid week day name
{{WEEKDAYNUMBER|xxx}}returns Expression error: Unrecognized word "xxx".
See also
- Template:WEEKDAYNAME
- Template:WEEKDAYABBREV, which performs the opposite operation of this template:
{{WEEKDAYABBREV|0}}→ Sun - Template:WEEKDAY
- Template:CURRENTWEEKDAY
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.