Snap Builder Public Codes Library
Snap | Generators | Login | Browse | Search | Enter Code | Export Snap Builder Public Codes Library

 

Category: Javascript Codes Library >> Clocks & Timers >> Countdown To Date


Code Snippet </> Info


Snippet Name: Countdown To Date

Description: Place a countdown to date script on your page with ease.

Compatible Browsers:
Chrome BrowserFirefox BrowserInternet Explorer BrowserOpera BrowserSafari Browser


Example: View Code Demo

Note:

Author: Sandeep Gangadharan

Last Modified: 2015-12-13 06:22:44

Language: javascript

Highlight Mode: javascript

Copy Codes: Use Free Notepad ++
Bookmark and Share

Snap HTML Code Editor:
Paste the source code, make changes and instantly see it in live preview.
Snap HTML Code Editor


  About Copying

<!DOCTYPE html> <head> <title>Countdown To Date Javascript Code Snippet</title> <script> <!-- /* Begin Countdown To Date == This Script Free To Use Providing This Notice Remains == == This Script Has Been Found In The http://snapbuilder.com Free Public Codes Library == == NOTICE: Though This Material May Have Been In A Public Depository, Certain Author Copyright Restrictions May Apply == == Created by: Sandeep Gangadharan : http://sivamdesign.com/scripts/ : Creative Commons License == */ function count() { month = 'Jan'; // change the month to the one you want in the same format as shown date = '01'; // change the date to the one you want in the same format as shown year = '2020'; // change the year to the one you want in the same format as shown theDate = month + ' ' + date + ' ' + year; now = new Date(); setdate = new Date(theDate); timer = (setdate - now) / 1000 / 60 / 60 / 24; timer = Math.round(timer); var message = timer + " days to go for the 2020 New Year!"; // Change the words at left to suit your needs if (timer == "1") message = timer + " day to go for the New Year!"; // This would be the message when there is one day to go if (timer == "0") message = "Less than a day to go for New Year!"; // Message when there is less that one day to go if (timer == "-1") message = "Happy New Year!!"; // Big Day Greeting if (timer < "-1") message = ""; // Blank space for when the day is past document.write(message); } // --> </script> </head> <body onLoad="count();"> [ YOUR CONTENT GOES HERE ] </body> </html


[ Snippet Options ]

 

© 2002 -  Snap Builder Public Codes Library