Hi,
How can I output a DateTime field to display as , for example "1st January 2023".
I used the format date but I can only get to "1 January 2023". I need to add the suffix for the day number
Also, I am outputting this value from a Service module so I do not have access to javascript.
See below. Its a pretty straight forward server action..get the day (number)In English, there are just 4possible suffixes, namely, "st', "nd", "rd" and "th"Check what number it is ...add the appropriate suffix to the day (number)the rest of the numbers will have "th" as the suffixlastly , output the built up long date with position as a text I added the option to add time(as a Input = bool) as well which might be helpfulMy action with variables looks like the following
Hello you need to customize this you can create a function based on your input and it will return you the output with the suffix ordinary number.
Some reference that might help you -
ThanksTousif Khan
You can use the foramtDateTime function, with the following format, "d MMMM yyyy ", Only this returns it without the ordinal suffix,
The solution for this is to use a Forge compont like I made Number Ordinal Multi Language to parse the day to a ordinal string and use the FormatDateTime with the format "MMMM yyyy " and prepend the result of the Ordinal value with the formated date.
If you need any assistants with the code or need an example please let me know
I ended up building my own server action that strips each section of the date and builds it back up into a full text
Hello
If you are willing to share the same here and mark it as a solution. that would be a real help to the community having the same issue in future.
Thanks
Thanks for the replies
Hi Randall Jodache Chetty ,
You can use this
https://www.outsystems.com/forge/component-overview/15402/reactive-ordinal-date-format
This will help you to achieve what you want.