ColdFusion Tutorial
Keeping the date on your site up to date
This is a common and easy coldfusion tip, which will help keeping the date of your site always up to date. Example: You have hard coded the copyright date on your site. After celebrating New Years Eve, you have to manually hardcode the New Year on all your pages. What a time wasted. Why not go back to bed, because you know that your coldfusion code will automatically update all of your pages.
But, before you can relax on next New Years Eve you have to write this short code in your coldfusion templates. Taking advantage of the DataPart function.
The DataPart function extracts a part from a date value and returns part of a date as an integer.
Syntax: DatePart("datepart","date")
Example:
<cfoutput>Copyright © #DatePart("yyyy", Now())# ScandicWeb. All Rights Reserved.</cfoutput>
ColdFusion Tutorial test
Keeping the date on your site up to date
Copyright © 2008 ScandicWeb. All Rights Reserved.
No User Comments.
No User Comments, be the first one to write your comments?
