robert.access Posted December 30, 2009 Share Posted December 30, 2009 hi! please somebody help me to set this to display + 5 hours in this script: <span id="servertime"></span> this is called from here (how to modify to display five hours ahead? Thanks): <script type="text/javascript"> var currenttime = '<?=$current_time_display;?>'; var serverdate=new Date(currenttime); function padlength(what){ var output=(what.toString().length==1)? "0"+what : what; return output; } function displaytime(){ serverdate.setSeconds(serverdate.getSeconds()+1) var timestring=padlength(serverdate.getHours())+":"+padlength(serverdate.getMinutes())+":"+padlength(serverdate.getSeconds()); document.getElementById("servertime").innerHTML=timestring; } window.onload=function(){ setInterval("displaytime()", 1000); } var ie4 = false; if(document.all) { ie4 = true; } function getObject(id) { if (ie4) { return document.all[id]; } else { return document.getElementById(id); } } function toggle(link, divId) { var lText = link.innerHTML; var d = getObject(divId); if (lText == '+') { link.innerHTML = '–'; d.style.display = 'block'; } else { link.innerHTML = '+'; d.style.display = 'none'; } } </script> Quote Link to comment https://forums.phpfreaks.com/topic/186720-countdown-5-hours/ Share on other sites More sharing options...
mikesta707 Posted December 30, 2009 Share Posted December 30, 2009 where do you define $current_time_display? if you use a timestamp, you can do something like the following $time = strtotime("+ 5 hours"); if you use the date() function, just pass that line above into the second optional parameter Quote Link to comment https://forums.phpfreaks.com/topic/186720-countdown-5-hours/#findComment-986059 Share on other sites More sharing options...
robert.access Posted December 30, 2009 Author Share Posted December 30, 2009 really don't know. It's a pre made script... can you be more explicit please Quote Link to comment https://forums.phpfreaks.com/topic/186720-countdown-5-hours/#findComment-986061 Share on other sites More sharing options...
oni-kun Posted December 30, 2009 Share Posted December 30, 2009 really don't know. It's a pre made script... can you be more explicit please Scripts usually always have some important info, in separate sections of the script, it seems you are only giving us bits at a time! maybe showing us the entire script would help.. and place the code between these tags: to be more readable.. Quote Link to comment https://forums.phpfreaks.com/topic/186720-countdown-5-hours/#findComment-986066 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.