0

Have this little countdown timer that counts down to 18:00 everyday and then resets as soon as it completes, the problems is I need to get it to work on the server time and not locally but I have no idea how?

Let me know if you need to look at the .js file!

Thanks in advance, Dan

<script language="javascript" type="text/javascript">
// Initiate Countdown
jQuery(document).ready(function() {
	$('#countdown_dashboard').countDown({
		targetDate: {
			'day': 		10,
			'month': 	11,
			'year': 	2999,
			'hour': 	18,
			'min': 		00,
			'sec': 		00,
			// time set as UTC 
			'utc':		true
		},
		
// onComplete function
						onComplete: function reset() {
					$('#countdown_dashboard').stopCountDown();
					$('#countdown_dashboard').setCountDown({
						targetOffset: {
							'day': 		10,
							'month': 	11,
							'year': 	2999,
							'hour': 	18,
							'min': 		00,
							'sec': 		00
						}
					});				
					$('#countdown_dashboard').startCountDown();
				}, 
				
				'omitWeeks': true,
				'serverStartTime' : true
					});
				});
				Cufon.replace('.digit');

				
		</script>
3
Contributors
4
Replies
10
Views
5 Years
Discussion Span
Last Post by bdanie
0

Dan,

I don't know which countdown plugin that is but this one by Keith Wood has a serverSync capability and is very well documented.

Airshow

Edited by Airshow: n/a

0

The timer appears not to have a sych() method and you don't have php available.

Other than choosing a different timer and a different host, it's difficult to see what the way ahead might be.

Airshow

0

First define the tag where you want to display the countdown timer !

<h1 id=countdown></h1>

and then type in this javascript !

<script>     
        $(function(){
    var BigDay = new Date("08 Sept 2015, 09:30:00");
    var msPerDay = 24 * 60 * 60 * 1000 ;


    window.setInterval(function(){
        var today = new Date();
        var timeLeft = (BigDay.getTime() - today.getTime());

        var e_daysLeft = timeLeft / msPerDay;
        var daysLeft = Math.floor(e_daysLeft);

        var e_hrsLeft = (e_daysLeft - daysLeft)*24;
        var hrsLeft = Math.floor(e_hrsLeft);

        var e_minsLeft = (e_hrsLeft - hrsLeft)*60;
        var minsLeft = Math.floor(e_minsLeft);

        var e_secsLeft = (e_minsLeft - minsLeft)*60;
        var secsLeft = Math.floor(e_secsLeft);


        var timeString = daysLeft + " d:" + hrsLeft + " h:" + minsLeft + " m:" + secsLeft+" s";
        $('#countdown').html(timeString);
    }, 1000);
})

</script>

This should work well !!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.