Th, nd, st On The End of a Date

Hi Team,

I’ve managed to figure out how to extract Day of the week and month etc. Is there a way to add th, nd, or st to a date?

All the best,

Ivan

Indirectly, yes.

You would need to add a new column (if you’re working in a table) where you SwitchIf() between dates needing th, nd, st. Then you use concatenate() to add the suffixes.

P

@Piet_Strydom That’s super, super cool thank you.

I had to do this earlier, here is the code I used
DateTh

Where the date I am working on is ‘aDate’

aDate.Day() +               // this shows the day-of-month and appends to that
  Switch(                   // this selects the 2 characters to append, 
    aDate.Day().Right(1),   // depending on the 2nd character of the day-of-month
    '1', 'st',              // if its a '1', append 'st'
    '2', 'nd',              // if its a '2', append 'nd'
    '3', 'rd',              // if its a '3', append 'rd'
    'th'                     // otherwise append 'th'
  )

Posting this in case its of use to others

respect
max

5 Likes

Brilliant. thanks @Agile_Dynamics I will give that a whirl.

1 Like