For fun, or perhaps a real need, you want to format a date in the old style, with diphthongs after the day number, etc., rendering “2009-06-23” as “the 23rd day of June in the year of Our Lord Two Thousand And Nine”.
Here’s how you would do it, supposing that the data element DateOfSignature holds the date to be formatted.
<<SetV(‘SignYear’,FormatDate(DateOfSignature,"yyyy"))>>in the year of Our Lord
Here’s how it works:
- The first
SetVsets the variable day to the day number of the DateOfSignature data element.
- <<FormatNumber(GetV(‘day’), “#”)>> removes any leading zeroes from the day variable value, and inserts the result into the document.
GetListItemcommand inserts the correct ordinal abbreviation for the day number into the document.
- The month name (spelled out in full) of DateOfSignature is inserted into the document by <<FormatDate(DateOfSignature, “MMMM”)>>.
- The last two commands firstly extract the year portion of the date, and then render that year number in words.
After setting the command out as above, you would change the font on the
<<GetListItem(...)>> command to be superscript (in fact, only the first
< needs to be superscripted). This will render 23rd as 23rd.
Note that since this article was written, a new feature has been added to the FormatDate function, which means that the production of dates in this archaic form is easier to achieve. Please have a look at The FormatDate and IncrementDate Functions and The OrdinalSuffix Function.