Your Internet Explorer is too old :( Please upgrade to latest IE or switch to Firefox/Google Chrome for better view!

December 19, 2011

New Year Countdown Clock

This is JavaScript widget which shows a countdown clock that will end on New Year‘s 2017 eve, and clock will be replaced by personal new year message.
You can add this script to your blog, website or somewhere else that support java script, html and CSS.
Copy the code below and paste to your website where you want to show countdown timer. If you are on blogger platform copy script and add new HTML/JavaScript widget then paste this code to its body.

New Year's Eve Countdown

Customizing code: This JavaScript is almost simple. Only few things you have to understand to modify this.
  • var newyr Creating new date instance of January 01, 2017
  • var newyeartime store time in milliseconds since January 1, 1970 to January 01, 2017
  • var todaytm creating new instance of local time
  • var timeleft store time in millisecond, difference of current time and January 01, 2017
  • var leftdays calculate and store days left using timeleft variable.
  • Math.floor() convert floating value in integer (lowest integer )
  • if (Math.floor(leftdays) <= -1) check if leftdays value reaches below 0 i.e -1
  • setTimeout('startTimer()',500) call function after every 0.5 second to update time.
So if you want to change timer then change the target date that is var newyr=new Date("January 1, 2017 00:00:00"); then the timer will we changed according to the target date.
You can also personalize message or time format these are written in If and else block.
Having any trouble ? comment here! 


  1. Thank you very much for sharing your new year counter code.
    great work

  2. Can you tell me how to add this falling share button on my site?

    1. Just keep an eye on this blog. Soon there will be a post about it.