New Year, New Copyright Year: Changing Your Copyright Date on Your Website Automatically
December 28th, 2009 by Janet Driscoll MillerIf you’re like me, you can barely remember to put the new year correctly on your checks when you write them. So if you’re like me, you likely forget to change your copyright date on your website as well.
Here’s a simple solution that can alleviate having to remember to change your copyright date each year: do it programmatically! My theory in life is ‘Why do it manually when you can have a computer remember to do it for you?”. And this situation is no different.
No matter what type of website you have or what language it is programmed in, you can easily assign your copyright date to auto-update to the current year. Here’s the code for various programming languages:
PHP
Copyright © <?php date(“Y”); ?>
Note that capitalization DOES matter in PHP, and it does matter here. Be sure to use the capital Y to get the full four-digit year.
Classic ASP/VBscript
Copyright © <%= year(date) %>
Javascript
Copyright © xxxx
<script language=”JavaScript”>
var d=new Date();
yr=d.getFullYear();
if (yr!=xxxx)
document.write(“- “+yr);
</script>
And replace xxx with the first year your website was published.
Now if I could only get my computer to help me remember to write the correct year on my checks…
Related Posts
|
|||



