eaglelegend Posted May 19, 2008 Share Posted May 19, 2008 Hey, I am trying to make the year go back like 1000 years on my live server script on my site, how do I make the year go back this quite large number of years XD? <script type="text/javascript"> var currenttime = '<? print date("F d, Y H:i:s", time())?>' //PHP method of getting server date var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December") 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 datestring=montharray[serverdate.getMonth()]+" "+padlength(serverdate.getDate())+", "+serverdate.getFullYear() var timestring=padlength(serverdate.getHours())+":"+padlength(serverdate.getMinutes())+":"+padlength(serverdate.getSeconds()) document.getElementById("servertime").innerHTML=datestring+" "+timestring } window.onload=function(){ setInterval("displaytime()", 1000) } </script> <div align="center"> <span id="servertime" class="text_box" alt="LOOK!, a clock!" title="LOOK!, a clock!"></span> </div><br> Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted May 20, 2008 Share Posted May 20, 2008 You could do something like this: var oneKYearsAgo = '<? print date("Y", strtotime("now - 1000 years"))?>' //PHP method of getting server date 1000 years ago Quote Link to comment Share on other sites More sharing options...
eaglelegend Posted May 20, 2008 Author Share Posted May 20, 2008 I tried your suggestion every way I could think of, it just didnt work :/ Quote Link to comment Share on other sites More sharing options...
eaglelegend Posted May 20, 2008 Author Share Posted May 20, 2008 this is what it now looks like... <script type="text/javascript"> var currenttime = '<?php print date("F d, Y H:i:s", time("now - 1000 years"))?>' //PHP method of getting server date 1000 years ago var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December") 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 datestring=montharray[serverdate.getMonth()]+" "+padlength(serverdate.getDate())+", "+serverdate.getFullYear() var timestring=padlength(serverdate.getHours())+":"+padlength(serverdate.getMinutes())+":"+padlength(serverdate.getSeconds()) document.getElementById("servertime").innerHTML=datestring+" "+timestring } window.onload=function(){ setInterval("displaytime()", 1000) } </script> <div align="center"> <span id="servertime" class="text_box" alt="LOOK!, a clock!" title="LOOK!, a clock!">Eagle Legend Server Time</span> Quote Link to comment 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.