Bring your best ideas to the AI Use Case Contest! Enter to win 40 hours of expert engineering support and bring your vision to life using the powerful combination of Alteryx + AI. Learn more now, or go straight to the submission form.
Start Free Trial

Alteryx Designer Desktop Ideas

Share your Designer Desktop product ideas - we're listening!
Submitting an Idea?

Be sure to review our Idea Submission Guidelines for more information!

Submission Guidelines

Add a format option to the DateTimeFormat function to display ordinal dates

I would like a new format option within the Designer function DateTimeFormat such that where a date is held in the database

e.g. 2023-01-01

 

DateTimeFormat([date],%o)

 

will return 1st not 1 or 01. 

 

Workarounds exist, but are fiddly given the different options....1st, 2nd, 3rd, 4th.....

2 Comments
Alekh
9 - Comet

Was looking for one but since it doesn't exist, here's my way of getting a date to format '1st January 1900', and by extension, the ordinal for any number:

 

trim(DateTimeFormat([modified_at],'%e')) //Day of Month
+
IIF(Right(ToString(DateTimeDay([modified_at])),2) in ('11','12','13'),'th',Switch(Right(ToString(DateTimeDay([modified_at])),1),'th','1','st','2','nd','3','rd')) //Ordinal: if last 2 digits are 11,12,13 then add th otherwise add st,nd,rd if last digit is 1,2,3 respectively
+
DateTimeFormat([modified_at], ' %B %Y') //Month + Year
nickdreach
9 - Comet

Yeah, I've no problem working out some database logic to do it (thanks for your code, by the way)...but if Alteryx could just provide a format option it would be so....easy!