On my site I am getting the current time via ajax function that returns the servers current timestamp and then creating a date object.
$.post(flipCountdownObj.ajax_url, data, function(response) {
var currentTime = new Date(parseInt(response) * 1000);
alert("Server says the time is " + currentTime.toLocaleTimeString());
// code to create my countdown here...
}
My logic then goes on to compare that date to various other dates to provide countdowns and event status.
My problem is though that everyone is getting different times.
I am in GMT. The server is in EST. For me it says the correct time but people in EST are saying that it is 4 hours out.
I don't understand why this is happening as the timestamp should be the same for everyone.
I saw a post saying about setting UTC time but not sure exactly what I am meant to do. Can anyone shed some light on what I am doing wrong?