Posted By

variantstudios on 12/31/08


Tagged

javascript date


Versions (?)

Who likes this?

5 people have marked this snippet as a favorite

jamesming
dimatter
supermauerbros
cwylie0
Biggs70


JavaScript Current Year


 / Published in: JavaScript
 

Paste this code in your HTML to display the current year. This script is commonly used in the © copyright's current year.

  1. <script type="text/javascript">
  2. now = new Date
  3. theYear=now.getYear()
  4. if (theYear < 1900)
  5. theYear=theYear+1900
  6. document.write(theYear)
  7. </script>

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: cwylie0 on January 19, 2011

Love it.

You need to login to post a comment.