Websites, SEO and web management, London UK.

SEO

Current year JavaScript

Sample 1. of writing a current year with JavaScript year function placed in body section.

JavaScript code:

<script type="text/javascript">
	//<![CDATA[
	var d=new Date();document.write('2000..'+d.getFullYear());
	//]]>
</script>

Outcome:

Sample 2. of writing JavaScript year.

This goes in to an external JavaScript file named javascripts.js.

//CURRENT YEAR
var d=new Date();
function year(){
	document.write(d.getFullYear());
}

This fragment in head section loads the external JavaScript code.

<script src="javascripts.js" type="text/javascript"></script>

This chunk of JavaScript code in body section calls the JavaScript year function and writes out the current year.

<script type="text/javascript">year()</script>

More reading about JavaScript year function and current year JavaScript

JavaScript Date and Time Object by tizag.com
JavaScript Date Object by w3schools.com


2012

Sample of writing a current year with the JavaScript year function, current year JavaScript, web development.