G
G
germanberg2016-12-30 14:44:34
JavaScript
germanberg, 2016-12-30 14:44:34

Script reverse report with GMT timezone how to do?

Help to fasten to this script of the return report, the time zone.
It is necessary that everyone who visits the site has the same time before X hour

<strong id="timer"></strong>
    <script>
    var outTimer = document.getElementById('timer'),
       secEnd = 11.00 * 3600, // секунд до 1:00
       serDay = 24 * 3600; // секунд в сутках
     
    setInterval(function () {
       var curDate = new Date(),
           curSec = curDate.getHours() * 3600 + curDate.getMinutes() * 60 + curDate.getSeconds() * 01,
           diff = secEnd - curSec;
     
       if (diff < 0) {
           diff = serDay + diff;
       }
     
       var hours = Math.floor(diff / 3600),
           minutes = Math.floor(diff / 60) % 60,
           seconds = Math.floor(diff) % 60;
     
       if (hours < 10) hours = '0' + hours;
       if (minutes < 10) minutes = '0' + minutes;
       if (seconds < 10) seconds = '0' + seconds;
       
       outTimer.innerHTML = hours + ':' + minutes + ':' + seconds;
    }, 10);
    </script>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
iBird Rose, 2016-12-30
@iiiBird

momentjs.com

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question