I am using the following script to do a countdown.
function startCountdown() {
var countdownDate = new Date("9/13/2013 12:00 AM");
var currentDate = new Date();
var dateDifference = new Date(countdownDate - currentDate);
var seconds = dateDifference.valueOf() / 1000;
CountBack(seconds);
}
function CountBack(seconds) {
var DisplayFormat = "DAYS days and HOURS hours";
DisplayFormat = DisplayFormat.replace("DAYS", (Math.floor(seconds/86400)) % 100000);
DisplayFormat = DisplayFormat.replace("HOURS", (Math.floor(seconds/3600)) % 24);
$('span.countdown').html(DisplayFormat);
}
startCountdown();
How can I show the months left too? (I want like: 3 months, 29 days and 3 hours)
Thank you.
Use this simple nice function. Check out the LIVE DEMO: