Talon Posted October 12, 2014 Posted October 12, 2014 (edited) Here's the working live time I got it running on my fluxcp but I'm not sure how to make it 3 minutes slower, perhaps anyone knows it? < script type="text/javascript"> function GetClock(){ d = new Date(); dx = d.toGMTString(); dx = dx.substr(0,dx.length -3); d.setTime(Date.parse(dx)) d.setSeconds(d.getSeconds() + <?php date_default_timezone_set('America/New_York'); echo date('Z'); ?>); nhour = d.getHours(); nmin = d.getMinutes(); nsec = d.getSeconds(); if(nhour == 0) {ap = " AM";nhour = 12;} else if(nhour <= 11) {ap = " AM";} else if(nhour == 12) {ap = " PM";} else if(nhour >= 13) {ap = " PM";nhour -= 12;} if(nmin <= 9) {nmin = "0" +nmin;} if(nsec <= 9) {nsec = "0" +nsec;} document.getElementById('clockbox').innerHTML=""+nhour+":"+nmin+":"+nsec+ap+""; setTimeout("GetClock()", 1000); } window.onload=GetClock; </script> Already fixed it, here's the code if anyone wants it <script type="text/javascript"> offset = Math.round(new Date().getTime() / 1000); function GetClock(){ tzOffset = -5;//set this to the number of hours offset from UTC tzOffset1 = -3; tzOffset2 = -15; d = new Date(); dx = d.toGMTString(); dx = dx.substr(0,dx.length -3); d.setTime(Date.parse(dx)) d.setHours(d.getHours() + tzOffset); d.setMinutes(d.getMinutes() + tzOffset1); d.setSeconds(d.getSeconds() + tzOffset2); nhour = d.getHours(); nmin = d.getMinutes(); nsec = d.getSeconds(); if(nhour == 0) {ap = " AM";nhour = 12;} else if(nhour <= 11) {ap = " AM";} else if(nhour == 12) {ap = " PM";} else if(nhour >= 13) {ap = " PM";nhour -= 12;} if(nmin <= 9) {nmin = "0" +nmin;} if(nsec <= 9) {nsec = "0" +nsec;} document.getElementById('clockbox').innerHTML=""+nhour+":"+nmin+":"+nsec+ap+""; setTimeout("GetClock()", 1000); } window.onload=GetClock; </script> <div id="clockbox"></div> Edited October 12, 2014 by Talon
Emistry Posted October 12, 2014 Posted October 12, 2014 you can just simply adjust your server time, all the website follow the time of your server/vps.
Talon Posted October 12, 2014 Author Posted October 12, 2014 (edited) May I know the scripts of it? So it could shorten my codes for faster loading time? Edited October 12, 2014 by Talon
Question
Talon
Here's the working live time I got it running on my fluxcp but I'm not sure how to make it 3 minutes slower, perhaps anyone knows it?
Already fixed it, here's the code if anyone wants it
Edited by Talon2 answers to this question
Recommended Posts