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 &copy; #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?

Add your comments

Your Name*:
Your Email:
Site URL:
Site Name:
Comemt Title*:
Your Comment*:
Key Phrase*:
Zx6
Your IP Address: 38.103.63.62
 

ScandicWeb is own by Scandic Systems LTD [UK] Company No. 5984000. All other trademarks and copyrights are the property of their respective holders.

[Home [Site Map [Privacy Statement [Site Feedback] [About ScandicWeb]


[ColdFusion [Flash [Search Engine Optimization [Graphics [Cascading Style Sheets (CSS) [JavaScript (JS) [Software]

Partner sites: ScandicSoft


Server time: 19. November 2008 Wednesday