I\'m writing a counting script who counts the time between an old date and today.
Everything worked good until I tested on a computer with wrong date and saw the resul
put this right at the top of your document:
var clientTime = new Date();
and this right at the bottom of your document:
var serverTime = new Date("");
var deltaTime = serverTime - clientTime; // in milliseconds (expected accuracy: < 1 second)
then, if you need to know the duration of something:
var startTime = new Date();
// [processing...]
var endTime = new Date();
var duration = endTime - startTime; // in milliseconds
var startTimeServer = startTime + deltaTime;
var endTimeServer = endTime + deltaTime;