Search code examples
crystal-reports

Convert current date to nth


How can I convert October 24, 2018 to 24th of October, 2018?


Solution

  • I think you need a formula. I don't know if there is a function ready-to-use. In english, you can do something like this:

    NumberVar DayIn := Day ({YourTable.YourDate});
    Totext (DayIn , 0 )
    & (if DayIn in 4 to 20 then 'th' else
    if remainder (DayIn , 10) = 1 then 'st' else
    if remainder (DayIn , 10) = 2 then 'nd' else
    if remainder (DayIn , 10) = 3 then 'rd' else 'th')
    & " of "
    & Totext ({YourTable.YourDate}, "MMMM, yyyy")