WordPress Tricks

Change year automatically at footer copyright section for your HTML, WordPress or Opencart based sites

IF you using wordpress, HTML or Opencart based sites and trying to change Year automatically for your footer copyright section or in your content section you can do it easily using the following code.

***The code has 2 part,

First Part Of Javascript code calculate the current year which will go in between Header section of your site.

function showDatey()
var now = new Date();
function fourdigitsy(number)
return (number < 1000) ? number + 1900 : number;
today =  fourdigitsy(now.getYear())  ;
document.getElementById("dateDivy").innerHTML = today;
setInterval("showDatey()", 1000);

Second Part: This html code will replace the Text Year which you want to change to be automated. Just replace that year using this code..

<span id="dateDivy"></span>

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s