Use Google to find help fast. For example, search on "xpressdox choosefromlist".

Format a date in archaic form

Format a date in archaic form

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(‘day’,FormatDate(DateOfSignature,"dd")) >>the <<FormatNumber(GetV(‘day’),"#")>><<GetListItem(GetV(‘day’),
'st,nd,rd,th,th,th,th,th,th,th,th,th,th,th,th,th,th,th,th,th,st,nd,rd,th,th,th,th,th,th,th,st')>>
day of <<FormatDate(DateOfSignature,"MMMM")>> <<SetV(‘SignYear’,FormatDate(DateOfSignature,"yyyy"))>>in the year of Our Lord <<NumberPhrase(GetV(‘SignYear’))>>.

Here’s how it works:

  • The first SetV sets 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.
  • The GetListItem command 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.

Leave a Reply