Our Online Blog

We have put together this blog to help, inform and inlight users regarding the internet, development and design. We also post all our network updates here to make sure you keep up to date with whats going on around you.

Search Blog

Coldfusion DateFormat

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!

Tags: , ,

Leave a Reply

You must be logged in to post a comment.