Auto update website year with Javascript

Never forget to update your website's copyright year again! Place the following snippet of code where you'd like the current year to appear:

<script>document.write(new Date().getFullYear())</script>

Example:

<footer>© 2005-<script>document.write(new Date().getFullYear())</script>. All rights reserved.</footer>

Would generate the following HTML:

© 2005-. All rights reserved.

Enjoyed what you saw? Stay updated by following me.


Share this page