Posted By

rumremix on 12/28/12


Tagged

year date current Jacascript


Versions (?)

dynamic current year with JavaScript


 / Published in: JavaScript
 

Often on a page footer, we want a copyright date range starting with the year the website was launched and ending the current year. Doing this dynamically means no need to update on 1/1 every year. The js snippet below uses the server date to accomplish this.

  1. © 2008-
  2. <script>var tD = new Date();var datestr = tD.getFullYear();document.write(datestr);</script>
  3. Name of Company

Report this snippet  

You need to login to post a comment.