Template:ordinal

Explain xkcd: It's 'cause you're dumb.
Jump to: navigation, search


This properly formats the given number as an abbreviated ordinal number in English.

Usage[edit]

{{ordinal|number[|flags(optional)]}}

  • number is the number to be formatted
    - Negative numbers get formatted as positive numbers with an negative sign added to the front of the number.
    - 0 gets formatted as "Zeroth".
  • flags indicates flags for the format of the output
    - If "R" is in flags, the output is formatted without commas.
    - If "S" is in flags, the output is formatted with the ordinal indicators not in superscripts.
    - Flags can be combined in any order.
    - If flags is omitted, the output is formatted as if no flags were given.

Examples[edit]

  • {{ordinal|1}}
produces
1st
  • {{ordinal|0002}}
produces
2nd
  • {{ordinal|0}}
produces
0th
  • {{ordinal|-00003}}
produces
-3rd
  • {{ordinal|123456789}}
produces
123,456,789th
  • {{ordinal|983,675,911}}
produces
983,675,911th
  • {{ordinal|123456|S}}
produces
123,456th
  • {{ordinal|00,314,159|R}}
produces
314159th
  • {{ordinal|-271828|RS}}
produces
-271828th
  • {{ordinal}} <!-- not recommended -->
produces
0th
First 29 ordinal numbers in English
Number Ordinal Number Ordinal Number Ordinal
0 0th 10 10th 20 20th
1 1st 11 11th 21 21st
2 2nd 12 12th 22 22nd
3 3rd 13 13th 23 23rd
4 4th 14 14th 24 24th
5 5th 15 15th 25 25th
6 6th 16 16th 26 26th
7 7th 17 17th 27 27th
8 8th 18 18th 28 28th
9 9th 19 19th 29 29th