Talon Posted October 12, 2014 Group: Members Topic Count: 24 Topics Per Day: 0.01 Content Count: 78 Reputation: 1 Joined: 09/01/14 Last Seen: October 22, 2016 Share 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 Link to comment Share on other sites More sharing options...
Emistry Posted October 12, 2014 Group: Forum Moderator Topic Count: 93 Topics Per Day: 0.02 Content Count: 10018 Reputation: 2369 Joined: 10/28/11 Last Seen: Sunday at 05:32 PM Share Posted October 12, 2014 you can just simply adjust your server time, all the website follow the time of your server/vps. Link to comment Share on other sites More sharing options...
Talon Posted October 12, 2014 Group: Members Topic Count: 24 Topics Per Day: 0.01 Content Count: 78 Reputation: 1 Joined: 09/01/14 Last Seen: October 22, 2016 Author Share 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 Link to comment Share on other sites More sharing options...
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 TalonLink to comment
Share on other sites
2 answers to this question
Recommended Posts