Template:MONTHNUMBER/doc: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
mNo edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{Documentation subpage}} | {{Documentation subpage}} | ||
__NOTOC__ | |||
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). | 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). | ||
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). | ||
=== Examples for all standard English month names === | === Examples for all standard English month names === | ||
: | : {{tlc|MONTHNUMBER|january}} {{Rarr}} {{MONTHNUMBER|january}} | ||
: | : {{tlc|MONTHNUMBER|february}} {{Rarr}} {{MONTHNUMBER|february}} | ||
: | : {{tlc|MONTHNUMBER|march}} {{Rarr}} {{MONTHNUMBER|march}} | ||
: | : {{tlc|MONTHNUMBER|april}} {{Rarr}} {{MONTHNUMBER|april}} | ||
: | : {{tlc|MONTHNUMBER|may}} {{Rarr}} {{MONTHNUMBER|may}} | ||
: | : {{tlc|MONTHNUMBER|june}} {{Rarr}} {{MONTHNUMBER|june}} | ||
: | : {{tlc|MONTHNUMBER|july}} {{Rarr}} {{MONTHNUMBER|july}} | ||
: | : {{tlc|MONTHNUMBER|august}} {{Rarr}} {{MONTHNUMBER|august}} | ||
: | : {{tlc|MONTHNUMBER|september}} {{Rarr}} {{MONTHNUMBER|september}} | ||
: | : {{tlc|MONTHNUMBER|october}} {{Rarr}} {{MONTHNUMBER|october}} | ||
: | : {{tlc|MONTHNUMBER|november}} {{Rarr}} {{MONTHNUMBER|november}} | ||
: | : {{tlc|MONTHNUMBER|december}} {{Rarr}} {{MONTHNUMBER|december}} | ||
=== Examples for all abbreviated English month names === | === Examples for all abbreviated English month names === | ||
: | : {{tlc|MONTHNUMBER|jan}} {{Rarr}} {{MONTHNUMBER|jan}} | ||
: | : {{tlc|MONTHNUMBER|feb}} {{Rarr}} {{MONTHNUMBER|feb}} | ||
: | : {{tlc|MONTHNUMBER|mar}} {{Rarr}} {{MONTHNUMBER|mar}} | ||
: | : {{tlc|MONTHNUMBER|apr}} {{Rarr}} {{MONTHNUMBER|apr}} | ||
: | : {{tlc|MONTHNUMBER|may}} {{Rarr}} {{MONTHNUMBER|may}} | ||
: | : {{tlc|MONTHNUMBER|jun}} {{Rarr}} {{MONTHNUMBER|jun}} | ||
: | : {{tlc|MONTHNUMBER|jul}} {{Rarr}} {{MONTHNUMBER|jul}} | ||
: | : {{tlc|MONTHNUMBER|aug}} {{Rarr}} {{MONTHNUMBER|aug}} | ||
: | : {{tlc|MONTHNUMBER|sep}} {{Rarr}} {{MONTHNUMBER|sep}} | ||
: | : {{tlc|MONTHNUMBER|oct}} {{Rarr}} {{MONTHNUMBER|oct}} | ||
: | : {{tlc|MONTHNUMBER|nov}} {{Rarr}} {{MONTHNUMBER|nov}} | ||
: | : {{tlc|MONTHNUMBER|dec}} {{Rarr}} {{MONTHNUMBER|dec}} | ||
=== Examples for all standard month numbers === | === Examples for all standard month numbers === | ||
: | : {{tlc|MONTHNUMBER|1}} {{Rarr}} {{MONTHNUMBER|1}} | ||
: | : {{tlc|MONTHNUMBER|2}} {{Rarr}} {{MONTHNUMBER|2}} | ||
: | : {{tlc|MONTHNUMBER|3}} {{Rarr}} {{MONTHNUMBER|3}} | ||
: | : {{tlc|MONTHNUMBER|4}} {{Rarr}} {{MONTHNUMBER|4}} | ||
: | : {{tlc|MONTHNUMBER|5}} {{Rarr}} {{MONTHNUMBER|5}} | ||
: | : {{tlc|MONTHNUMBER|6}} {{Rarr}} {{MONTHNUMBER|6}} | ||
: | : {{tlc|MONTHNUMBER|7}} {{Rarr}} {{MONTHNUMBER|7}} | ||
: | : {{tlc|MONTHNUMBER|8}} {{Rarr}} {{MONTHNUMBER|8}} | ||
: | : {{tlc|MONTHNUMBER|9}} {{Rarr}} {{MONTHNUMBER|9}} | ||
: | : {{tlc|MONTHNUMBER|10}} {{Rarr}} {{MONTHNUMBER|10}} | ||
: | : {{tlc|MONTHNUMBER|11}} {{Rarr}} {{MONTHNUMBER|11}} | ||
: | : {{tlc|MONTHNUMBER|12}} {{Rarr}} {{MONTHNUMBER|12}} | ||
=== Examples for month numbers with extra leading zero === | === Examples for month numbers with extra leading zero === | ||
: | : {{tlc|MONTHNUMBER|01}} {{Rarr}} {{MONTHNUMBER|01}} | ||
: | : {{tlc|MONTHNUMBER|02}} {{Rarr}} {{MONTHNUMBER|02}} | ||
: | : {{tlc|MONTHNUMBER|03}} {{Rarr}} {{MONTHNUMBER|03}} | ||
: | : {{tlc|MONTHNUMBER|04}} {{Rarr}} {{MONTHNUMBER|04}} | ||
: | : {{tlc|MONTHNUMBER|05}} {{Rarr}} {{MONTHNUMBER|05}} | ||
: | : {{tlc|MONTHNUMBER|06}} {{Rarr}} {{MONTHNUMBER|06}} | ||
: | : {{tlc|MONTHNUMBER|07}} {{Rarr}} {{MONTHNUMBER|07}} | ||
: | : {{tlc|MONTHNUMBER|08}} {{Rarr}} {{MONTHNUMBER|08}} | ||
: | : {{tlc|MONTHNUMBER|09}} {{Rarr}} {{MONTHNUMBER|09}} | ||
=== Examples for month number underflows and overflows, from computed values === | === Examples for month number underflows and overflows, from computed values === | ||
: | : {{tlc|MONTHNUMBER|-1200}} {{Rarr}} {{MONTHNUMBER|-1200}} | ||
: | : {{tlc|MONTHNUMBER|-1201}} {{Rarr}} {{MONTHNUMBER|-1201}} | ||
: | : {{tlc|MONTHNUMBER|-1212}} {{Rarr}} {{MONTHNUMBER|-1212}} | ||
: | : {{tlc|MONTHNUMBER|-12}} {{Rarr}} {{MONTHNUMBER|-12}} | ||
: | : {{tlc|MONTHNUMBER|-11}} {{Rarr}} {{MONTHNUMBER|-11}} | ||
: | : {{tlc|MONTHNUMBER|-10}} {{Rarr}} {{MONTHNUMBER|-10}} | ||
: | : {{tlc|MONTHNUMBER|-9}} {{Rarr}} {{MONTHNUMBER|-9}} | ||
: | : {{tlc|MONTHNUMBER|-8}} {{Rarr}} {{MONTHNUMBER|-8}} | ||
: | : {{tlc|MONTHNUMBER|-7}} {{Rarr}} {{MONTHNUMBER|-7}} | ||
: | : {{tlc|MONTHNUMBER|-6}} {{Rarr}} {{MONTHNUMBER|-6}} | ||
: | : {{tlc|MONTHNUMBER|-5}} {{Rarr}} {{MONTHNUMBER|-5}} | ||
: | : {{tlc|MONTHNUMBER|-4}} {{Rarr}} {{MONTHNUMBER|-4}} | ||
: | : {{tlc|MONTHNUMBER|-3}} {{Rarr}} {{MONTHNUMBER|-3}} | ||
: | : {{tlc|MONTHNUMBER|-2}} {{Rarr}} {{MONTHNUMBER|-2}} | ||
: | : {{tlc|MONTHNUMBER|-1}} {{Rarr}} {{MONTHNUMBER|-1}} | ||
: | : {{tlc|MONTHNUMBER|-0.9999}} {{Rarr}} {{MONTHNUMBER|-0.9999}} | ||
: | : {{tlc|MONTHNUMBER|-0.5}} {{Rarr}} {{MONTHNUMBER|-0.5}} | ||
: | : {{tlc|MONTHNUMBER|-0.0001}} {{Rarr}} {{MONTHNUMBER|-0.0001}} | ||
: | : {{tlc|MONTHNUMBER|0}} {{Rarr}} {{MONTHNUMBER|0}} | ||
: | : {{tlc|MONTHNUMBER|0.0001}} {{Rarr}} {{MONTHNUMBER|0.0001}} | ||
: | : {{tlc|MONTHNUMBER|0.5}} {{Rarr}} {{MONTHNUMBER|0}} | ||
: | : {{tlc|MONTHNUMBER|0.9999}} {{Rarr}} {{MONTHNUMBER|0.9999}} | ||
: | : {{tlc|MONTHNUMBER|12.0001}} {{Rarr}} {{MONTHNUMBER|12.0001}} | ||
: | : {{tlc|MONTHNUMBER|12.5}} {{Rarr}} {{MONTHNUMBER|12.5}} | ||
: | : {{tlc|MONTHNUMBER|12.9999}} {{Rarr}} {{MONTHNUMBER|12.9999}} | ||
: | : {{tlc|MONTHNUMBER|13}} {{Rarr}} {{MONTHNUMBER|13}} | ||
: | : {{tlc|MONTHNUMBER|14}} {{Rarr}} {{MONTHNUMBER|14}} | ||
: | : {{tlc|MONTHNUMBER|24}} {{Rarr}} {{MONTHNUMBER|24}} | ||
: | : {{tlc|MONTHNUMBER|1200}} {{Rarr}} {{MONTHNUMBER|1200}} | ||
: | : {{tlc|MONTHNUMBER|1201}} {{Rarr}} {{MONTHNUMBER|1201}} | ||
: | : {{tlc|MONTHNUMBER|1212}} {{Rarr}} {{MONTHNUMBER|1212}} | ||
=== Example for invalid month name === | === Example for invalid month name === | ||
: | : {{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|| | |||
<!-- Categories below this line, please --> | <!-- Categories below this line, please --> | ||
[[Category: | [[Category:Utility templates]] | ||
</includeonly> | }}}}</includeonly> |
Latest revision as of 02:06, 20 August 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 |