Jump to content

Recommended Posts

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 = '&#8211;'; d.style.display = 'block'; }

else { link.innerHTML = '+'; d.style.display = 'none'; }

}

 

</script>

Link to comment
https://forums.phpfreaks.com/topic/186720-countdown-5-hours/
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/186720-countdown-5-hours/#findComment-986059
Share on other sites

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..

Link to comment
https://forums.phpfreaks.com/topic/186720-countdown-5-hours/#findComment-986066
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.