Our online blog

Posts Tagged ‘coldfusion dateformat’

Coldfusion DateFormat

Tuesday, June 16th, 2009

The Coldfusion dateformat works in the same sort of fashion as the ASP.NET and the PHP date time function. As our team mainly works in Coldfusion we can expand alot more on this function that ASP.NET / PHP.

The code: (Use this code within a <cfoutput></cfoutput> tag)

#DateFormat(Now(), "YYYY")#

About the code:

As you can see all we start with DateFormat which states will want to have a date format (You can use TimeFormat to work with times). Next we are getting the current date with the Now() and then we have the formatting of the date, as we only want the year we are using ‘YYYY’ (Displays: 2009) or you can use ‘YY’ (Displays: 09)

Enjoy!