Template:MONTHNUMBER/doc

From HIBIKIFORUM
Jump to navigation Jump to search
Light bulb.png }}
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".