JavaScript Current Year

/ Published in: JavaScript
Save to your folder(s)

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

Copy this code and paste it in your HTML
  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


RSS Icon Subscribe to comments

You need to login to post a comment.