April 18, 2011

OrdinalSuffix - XpressDox

This function is used internally by XpressDox’s FormatDate function to form dates like March 3rd 2011.  The “rd” after the “3” is known as an ordinal suffix.  The function used to return this date would be «FormatDate(DateOfSignature,'MMMM o yyyy")»

The template author would use the OrdinalSuffix function explicitly in order to render the “rd” above as a superscript, because the FormatDate o formatting code on its own cannot do superscripting.

The way this is achieved is to use «FormatDate(DateOfSignature,'d')» to return the day of the month, and then pass that to OrdinalSuffix in this way: «OrdinalSuffix(FormatDate(DateOfSignature,'d'))».  This will render the “rd” required in the above example.

The full sequence of commands would be:

«FormatDate(DateOfSignature,'d')» «OrdinalSuffix(FormatDate(DateOfSignature,'d'))» «FormatDate(DateOfSignature,'MMMM yyyy')»

and the «OrdinalSuffix()» function would need to be superscripted by setting its Word font properties in the template.

Should the need for formatting the date in the old style arise, the following could be used:

«FormatDate(DateOfSignature,'d')»«OrdinalSuffix(FormatDate(DateOfSignature,'d'))» day of «FormatDate(DateOfSignature,'MMMM')», in the year of Our Lord «FormatDate(DateOfSignature,'yyyy')»