If Mods feel it is not the correct section please move it or delete it. I need help with my site clock. PHP: function tS(){ x=new Date(tN().getUTCFullYear(),tN().getUTCMonth(),tN().getUTCDate(),tN().getUTCHours(),tN().getUTCMinutes(),tN().getUTCSeconds()); x.setTime(x.getTime()+3600000); return x; } function tN(){ return new Date(); } function lZ(x){ return (x>10)?x:'0'+x; } function y2(x){ x=(x<500)?x+1900:x; return String(x).substring(2,4) } function dT(){ if(fr==0){ fr=1; document.write('<font size=2 face=Arial><b><span id="tP">'+eval(oT)+'</span></b></font>'); } document.getElementById('tP').innerHTML=eval(oT); setTimeout('dT()',1000); } var dN=new Array('Sun','Mon','Tue','Wed','Thu','Fri','Sat'),mN=new Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'),fr=0,oT="dN[tS().getDay()]+' '+tS().getDate()+' '+mN[tS().getMonth()]+' '+y2(tS().getYear())+' '+':'+':'+' '+lZ(tS().getHours())+':'+lZ(tS().getMinutes())+':'+lZ(tS().getSeconds())+' '"; here is what i get in my clock.js file. Its working fine but its one hour late. e.g its 13:56 on the website now , anyone can tell me how i can add 1 hour to it, so that it shows 14:56 Thanx devillived
Wow, that's a heck of a mess. Firstly, you say PHP code but it's javascript. Secondly, it's way more cludgy than it should be. http://www.tizag.com/javascriptT/javascriptdate.php
I haven't checked this but have you already tried the following code? Code: function tS(){ x=new Date(tN().getUTCFullYear(),tN().getUTCMonth(),tN().getUTCDate(),(tN().getUTCHours() - 1),tN().getUTCMinutes(),tN().getUTCSeconds()); x.setTime(x.getTime()+3600000); return x; } function tN(){ return new Date(); } function lZ(x){ return (x>10)?x:'0'+x; } function y2(x){ x=(x<500)?x+1900:x; return String(x).substring(2,4) } function dT(){ if(fr==0){ fr=1; document.write('<font size=2 face=Arial><b><span id="tP">'+eval(oT)+'</span></b></font>'); } document.getElementById('tP').innerHTML=eval(oT); setTimeout('dT()',1000); } var dN=new Array('Sun','Mon','Tue','Wed','Thu','Fri','Sat'),mN=new Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'),fr=0,oT="dN[tS().getDay()]+' '+tS().getDate()+' '+mN[tS().getMonth()]+' '+y2(tS().getYear())+' '+':'+':'+' '+lZ(tS().getHours())+':'+lZ(tS().getMinutes())+':'+lZ(tS().getSeconds())+' '"; If it were PHP it would work but as its JS I cannot be arsed to check it, sorry dude.