June 16, 2009

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!

Leave a Reply

Your email address will not be published. Required fields are marked *

About Host Media

We have been hosting websites since 2002 and are always moving forward. All articles written under the Host Media author are created by the team who support our customers.

Category

ColdFusion/Railo & MySQL

Tags

, ,