dcsimg
Login | Register   
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: JavaScript
Expertise: Intermediate
Jun 2, 2003

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


Dynamically Change the Year in Your Source Code

This little bit of code is great for doing stuff like "COPYRIGHT 1998—(present year)." It saves Webmasters from having to cull through their source code looking for the year (every year on January 1st) to change it manually.

Here's an example:


© 1998 - <script language="JavaScript" type="text/javascript">
var today = new Date()
var year = today.getYear()
if (year < 1900)
{
year = year + 1900;
}
document.write(year)
</script> 
Donald Demrow
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date