Template:MONTHNAME: Difference between revisions
mNo edit summary |
m (end of caveats when rounding negative numbers (the round operator rounds up positive halves, but rounds down negative halves), and modulo does not work correctly on négative numbers) |
||
Line 1: | Line 1: | ||
<includeonly>{{#if:{{{1|}}}|{{#switch:{{#ifexpr:{{{1|}}}<0|{{#ifexpr:({{{1|}}} round 0)!={{{1|}}}|{{#expr: | <includeonly>{{#if:{{{1|}}}|{{#switch:{{#ifexpr:{{{1|}}}<0|{{#ifexpr:({{{1|}}} round 0)!={{{1|}}}|{{#expr:(((9.5-{{{1|}}})round 0)mod 12)+1}}|{{#expr:(((8.5-{{{1|}}})round 0)mod 12)+1}}}}|{{#expr:(((10.5+{{{1|}}})round 0)mod 12)+1}}}}|1=january|2=february|3=march|4=april|5=may|6=june|7=july|8=august|9=september|10=october|11=november|12=december|Incorrect required parameter 1=''month''!}}|Missing required parameter 1=''month''!}}</includeonly><noinclude>{{Template documentation}} | ||
}}|{{#expr: | |||
}}}}|{{#expr: | |||
This template returns the name of the month whose number is in parameter. | This template returns the name of the month whose number is in parameter. | ||
; Syntax<nowiki>:</nowiki> | ; Syntax<nowiki>:</nowiki> |
Revision as of 01:01, 23 April 2006
Template:Template documentation This template returns the name of the month whose number is in parameter.
- Syntax:
- {{MONTHNAME|month}}
- The month value is interpreted modulo 12 (extra leading zeroes and decimals are ignored).
- Examples for all months:
- {{MONTHNAME|1}} returns january
- {{MONTHNAME|2}} returns february
- {{MONTHNAME|3}} returns march
- {{MONTHNAME|4}} returns april
- {{MONTHNAME|5}} returns may
- {{MONTHNAME|6}} returns june
- {{MONTHNAME|7}} returns july
- {{MONTHNAME|8}} returns august
- {{MONTHNAME|9}} returns september
- {{MONTHNAME|10}} returns october
- {{MONTHNAME|11}} returns november
- {{MONTHNAME|12}} returns december
- Examples for months with extra leading zero:
- {{MONTHNAME|01}} returns january
- {{MONTHNAME|02}} returns february
- {{MONTHNAME|03}} returns march
- {{MONTHNAME|04}} returns april
- {{MONTHNAME|05}} returns may
- {{MONTHNAME|06}} returns june
- {{MONTHNAME|07}} returns july
- {{MONTHNAME|08}} returns august
- {{MONTHNAME|09}} returns september
- Examples for month number underflow and overflow, from computed values:
- {{MONTHNAME|-1}} returns november
- {{MONTHNAME|-0.9999}} returns november
- {{MONTHNAME|-0.5}} returns november
- {{MONTHNAME|-0.0001}} returns november
- {{MONTHNAME|0}} returns december
- {{MONTHNAME|0.0001}} returns december
- {{MONTHNAME|0.5}} returns december
- {{MONTHNAME|0.9999}} returns december
- {{MONTHNAME|12.0001}} returns december
- {{MONTHNAME|12.5}} returns december
- {{MONTHNAME|12.9999}} returns december
- {{MONTHNAME|13}} returns january
- See also:
- Template:CURRENTMONTHNAME