Countdown To Date - Place a countdown to date script on your page with ease. Compatible Browsers: Example: View Code Demo |
<!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 https://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
|
Scroll