Automatic, Always Up-To-Date Copyright On Your Website

Do you want a copyright in your footer (or anywhere else on your webpage) that will automatically change over to the next year without you having to edit a thing? There are two very easy ways to accomplish this using either PHP or Javascript.

Insert The Current Year With PHP

Using PHP to insert the copyright is the best way to do it if your server / page has it enabled. The reason is that since it's processed on the server side before sending the page to your visitors, their settings (for example if they have javascript disabled) won't effect the outcome so it will always show up.

It's also super easy to do, simply add <?php echo date('Y') ?> instead writing the current year manually... Really, that's it, easy as pie.

For example, your HTML code could look something like this:
&copy; Copyright Example.com 1998 - <?php echo date('Y') ?>

Which would show on the page as:
© Copyright Example.com 1998 - 2024

Insert The Current Year With Javascript

If your webpage / website isn't PHP enabled, there's always javascript to fall back on and it's also very easy to do, add this where you want the current year to show up:
<script>document.write(new Date().getFullYear())</script>

Now, there is one problem with that code above, if your visitor has javascript disabled nothing will show up, so if you're using it as part of the copyright, you might be left with an odd blank space. To get around that there is the option of writing the entire copyright in javascript (yes, that means nothing will show up if it's disabled, but it may look tidier than having a blank spot. It's your call.).

If you'd prefer to go all out and do the entire thing in script, this handy little tool may be of help. Simply fill your details into the form below, then copy and paste the freshly generated code into your page where you'd like your copyright information to appear.