Skip to content
gplaza edited this page May 28, 2014 · 1 revision

Hour from server with php :

jQuery(function($){

var d = new Date();
var serverTimeHour = <?= date('H') ?>;
var serverTimeMinute = <?= date('i') ?>;
var serverTimeSecond = <?= date('s') ?>;

var interHour = (d.getHours() - serverTimeHour)*-1;
var interMinute = (d.getMinutes() - serverTimeMinute)*-1;
var interSecond = (d.getSeconds() - serverTimeSecond)*-1;

$('#serverClock').flipcountdown({
	size:"lg",
	tick:function(){
		var nol = function(h){ return h>9?h:'0'+h; }
		d = new Date();
		return nol(d.getHours() + interHour) + ':' + nol(d.getMinutes() + interMinute) + ':' + nol(d.getSeconds() + interSecond);
}});

})

Clone this wiki locally