January 1st comes around every year at the same time, but it used to always catch me off guard with respect to updating my websites’ copyright notices. That is until I found this handy little code snippet. First, let me say that I am NOT the original author of this code snippet. I would love to know who wrote it so that I can finally thank them for relieving me of this yearly task. I’m sure I stumbled upon this in a sea of search results, likely several replies down into a JavaScript forum posting. Regardless, here is the simplest, JavaScript-based way I’ve found to always be displaying the current year in your websites’s copyright notice:
<p>© Copyright 2000-
<script language="JavaScript" type="text/javascript">
now = new Date
theYear=now.getYear()
if (theYear < 1900)
theYear=theYear+1900
document.write(theYear)
</script>
Logical Things, Inc. All rights reserved. Version 4.01g</p>
There might even be a leaner way to do it, but this has always worked perfectly well for me. Have an even easier way? Let me know!
Follow on Twitter
“Like” on Facebook
Plus 1