Untitled UI logotext
Solutions
WebsitesEcommerceMobile AppsWeb AppsProduction Support & Maintenance
Our work
Company
About usBlogPodcastContact us
Book a free consultation

Automatically Updating Copyright Year

Olivia Rhye

The holidays are almost over and 2016 is in the books, and as much as some people would like to put it behind them we need to first take care of some simple housekeeping. So leave the tree up and all the holiday decorations where they are because we have something way more important to take care of. That's right, I'm talking about updating the copyright year that's most likely tucked away in the footer of your site.

But wait, there's more! You can automatically update the copyright year easily by inserting a simple JavaScript or php script into your html so you never have to worry about it again. They php method is a little cleaner but if you are running a static HTML site, the JS way of doing it works just as well.

php


echo date('Y');

jQuery


function copyDate(tar) {
var today = new Date();
var year = today.getFullYear();

$(tar).text(year);
}

$(document).ready(function() {

// target element to populate with the date, in this case
copyDate('.copyright');

});

Good luck, and happy 2017.

Ready to start a project?

Book a free consultation
Untitled UI logotext
Our work
About us
Blog
Careers
Submit a ticket
Agency Partnerships
Contact
© 2024 fjorge. All rights reserved.
Privacy