Best of Support

Ordinal display of numbers

Issue

How do we get an ordinal display of numbers, i.e., 1st, 2nd, 3rd, ... 12th ... 33rd?

 

We can get the date into a cardinal display, such as First, Second, Third, ... Twelfth ... Thirty-third, using the FillPoint:

%[NumberToRanking(FormatDate(WarrantinDebt.DateFromWhichClaimIsDue,'dd'))].

Solution:

DateToWords with a "false" parameter will give the date in words, and the day displayed as an ordinal number:

For example:

%[DateToWords(date(), false)]

will give:

11th day of June, 2002

 

So, to get just the ordinal number we need to extract the first element of this result, with the element separator being a space. In which case:

%[Element(1, DateToWords(date(), false), ' ')]

should return:

11th

 

Daniel Todes