Automatically Updating Copyright Year
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.