Template:MONTHNUMBER/doc: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
mNo edit summary |
||
Line 7: | Line 7: | ||
=== Syntax === | === Syntax === | ||
: {{ | : {{tji|MONTHNUMBER|month}} | ||
* The ''month'' value is interpreted modulo 12 (extra leading zeroes are ignored, negative numbers are accepted, all numbers are rounded to floor). | * The ''month'' value is interpreted modulo 12 (extra leading zeroes are ignored, negative numbers are accepted, all numbers are rounded to floor). | ||
Line 98: | Line 98: | ||
=== Example for invalid month name === | === Example for invalid month name === | ||
: {{tlc|MONTHNUMBER|xx}} {{Rarr}} {{MONTHNUMBER|xx}} | : {{tlc|MONTHNUMBER|xx}} {{Rarr}} {{MONTHNUMBER|xx}} | ||
== TemplateData == | |||
<templatedata> | |||
{ | |||
"description": "Returns the cyclic integer month number (between 1 and 12) of the month whose real number is in parameter.", | |||
"params": { | |||
"1": { | |||
"label": "Month Number", | |||
"description": "The number to input for a month.", | |||
"type": "number", | |||
"suggestedvalues": [ "1", "Jan", "January" ], | |||
"required": true | |||
} | |||
} | |||
} | |||
</templatedata> | |||
<includeonly>{{sandbox other||{{testcases other|| | <includeonly>{{sandbox other||{{testcases other|| |
Revision as of 04:30, 18 June 2023
It contains usage information, categories and other content that is not part of the original template page.
|
This template returns the cyclic integer month number (between 1 and 12) of the month whose real number is in parameter. Alternatively, the month can be given with its English name (complete or abbreviated to 3 characters, with capitals or small letters).
Does not play nicely with "subst:"
Syntax
- {{MONTHNUMBER
|month}}
- The month value is interpreted modulo 12 (extra leading zeroes are ignored, negative numbers are accepted, all numbers are rounded to floor).
Examples for all standard English month names
{{MONTHNUMBER|january}}
→ 1{{MONTHNUMBER|february}}
→ 2{{MONTHNUMBER|march}}
→ 3{{MONTHNUMBER|april}}
→ 4{{MONTHNUMBER|may}}
→ 5{{MONTHNUMBER|june}}
→ 6{{MONTHNUMBER|july}}
→ 7{{MONTHNUMBER|august}}
→ 8{{MONTHNUMBER|september}}
→ 9{{MONTHNUMBER|october}}
→ 10{{MONTHNUMBER|november}}
→ 11{{MONTHNUMBER|december}}
→ 12
Examples for all abbreviated English month names
{{MONTHNUMBER|jan}}
→ 1{{MONTHNUMBER|feb}}
→ 2{{MONTHNUMBER|mar}}
→ 3{{MONTHNUMBER|apr}}
→ 4{{MONTHNUMBER|may}}
→ 5{{MONTHNUMBER|jun}}
→ 6{{MONTHNUMBER|jul}}
→ 7{{MONTHNUMBER|aug}}
→ 8{{MONTHNUMBER|sep}}
→ 9{{MONTHNUMBER|oct}}
→ 10{{MONTHNUMBER|nov}}
→ 11{{MONTHNUMBER|dec}}
→ 12
Examples for all standard month numbers
{{MONTHNUMBER|1}}
→ 1{{MONTHNUMBER|2}}
→ 2{{MONTHNUMBER|3}}
→ 3{{MONTHNUMBER|4}}
→ 4{{MONTHNUMBER|5}}
→ 5{{MONTHNUMBER|6}}
→ 6{{MONTHNUMBER|7}}
→ 7{{MONTHNUMBER|8}}
→ 8{{MONTHNUMBER|9}}
→ 9{{MONTHNUMBER|10}}
→ 10{{MONTHNUMBER|11}}
→ 11{{MONTHNUMBER|12}}
→ 12
Examples for month numbers with extra leading zero
{{MONTHNUMBER|01}}
→ 1{{MONTHNUMBER|02}}
→ 2{{MONTHNUMBER|03}}
→ 3{{MONTHNUMBER|04}}
→ 4{{MONTHNUMBER|05}}
→ 5{{MONTHNUMBER|06}}
→ 6{{MONTHNUMBER|07}}
→ 7{{MONTHNUMBER|08}}
→ 8{{MONTHNUMBER|09}}
→ 9
Examples for month number underflows and overflows, from computed values
{{MONTHNUMBER|-1200}}
→ 12{{MONTHNUMBER|-1201}}
→ 11{{MONTHNUMBER|-1212}}
→ 12{{MONTHNUMBER|-12}}
→ 12{{MONTHNUMBER|-11}}
→ 1{{MONTHNUMBER|-10}}
→ 2{{MONTHNUMBER|-9}}
→ 3{{MONTHNUMBER|-8}}
→ 4{{MONTHNUMBER|-7}}
→ 5{{MONTHNUMBER|-6}}
→ 6{{MONTHNUMBER|-5}}
→ 7{{MONTHNUMBER|-4}}
→ 8{{MONTHNUMBER|-3}}
→ 9{{MONTHNUMBER|-2}}
→ 10{{MONTHNUMBER|-1}}
→ 11{{MONTHNUMBER|-0.9999}}
→ 11{{MONTHNUMBER|-0.5}}
→ 11{{MONTHNUMBER|-0.0001}}
→ 11{{MONTHNUMBER|0}}
→ 12{{MONTHNUMBER|0.0001}}
→ 12{{MONTHNUMBER|0.5}}
→ 12{{MONTHNUMBER|0.9999}}
→ 12{{MONTHNUMBER|12.0001}}
→ 12{{MONTHNUMBER|12.5}}
→ 12{{MONTHNUMBER|12.9999}}
→ 12{{MONTHNUMBER|13}}
→ 1{{MONTHNUMBER|14}}
→ 2{{MONTHNUMBER|24}}
→ 12{{MONTHNUMBER|1200}}
→ 12{{MONTHNUMBER|1201}}
→ 1{{MONTHNUMBER|1212}}
→ 12
Example for invalid month name
{{MONTHNUMBER|xx}}
→ Expression error: Unrecognized word "xx".
TemplateData
Returns the cyclic integer month number (between 1 and 12) of the month whose real number is in parameter.
Parameter | Description | Type | Status | |
---|---|---|---|---|
Month Number | 1 | The number to input for a month.
| Number | required |