It’s 2018! How to update your footer!

When 2018 rolled around, I’ll bet most companies with a web presence scrambled to update their footers to indicate they were still in business. Nothing is more fishy than checking out a website and finding out their copyright year is a little behind. Makes you wonder if they’re still in business, right?

Copyright 2010. Hmm. Moving right along.

(I totally made the mistake of forgetting to update my website once)

Well, hallelujah, there’s a way to avoid all that scrambling next year, and let your computer do the update automatically, after you implement either one of these very simple snippets. It’s time to update your footer!

Javascript option; browser-side

<script type="text/javascript">
document.write(new Date().getFullYear());

This will give you the year; 2018 for this year, for example. It’ll change automagically to 2019 next year.

PHP option; server-side

If you prefer php, or prefer to play eenie-meenie-miney-mo between two choices, here goes:

echo date("Y");

Again, this gives you the year 2018.

Dress it up

For example, if you are wanting to display a copyright next to your php script, it would go something like this:

&copy; <?php echo date("Y"); ?>

Which would display this: © 2018.