How to display date in ordinal form in Coldfusion

 There are some requirements where we need to display the date value as ordinal form. For example, 31st august. Below code will do that in coldfusion.


<cfset SuffixList=["st", "nd", "rd", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "st", "nd", "rd", "th", "th", "th", "th", "th", "th", "th", "st"]>

<cfoutput>#DateFormat(now(),'d')##SuffixList[DateFormat(now(),'d')]#</cfoutput>

Comments

Popular posts from this blog

how to add new line in google form questions | Fix for next line issue in google form questions

How to add new line in dropdown type question in google forms