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>

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

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

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 !!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.