Template:Ordinal

Use
This template will generate an appropriate ordinal suffix for a given number.

It could use stylesheet options for superscripted suffixes (i.e. 101st) and the -d suffixes used in the legal field (i.e. 3d or 22d).