Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hiya Does Anyone Know How I Can Get This Javascipt To Use The Website's Server Time Instead of the user's system time.
http://www.stephenallden.co.uk/java...
Cheers!!! :-)

You again! LOL.
Unless the server is running ASP, you can't. And, if the server is not running ASP and this is the only reason you want to, I think that would be a lot more trouble than it's worth.
Are you having problems with the previous code not working to adjust the user's time to your local time?
Michael J

By the way, why did you revert back to the long way of doing that code? I.e. writing the complete line of HTML within each line. If you want each line to be the same (with the exception of the image name) you should just use the IF/ELSE's to determine the image name and then write the HTML.
Doing otherwise can create major headaches down the road if one line has a mistake in it. Plus, you need to end the document.write commands with a semicolon.
time = day.getHours()*60 + day.getMinutes();
if(time<300) { // 12:00 am
imgname = "1.gif"
} else if(time<600) { //5:00 am
imgname = "2.gif"
.
.
.
}document.write('');
Michael J

if you wnat to use php this will work for pulling the server's time (you can adjust the server time by adjusting the first variable)
<?php
$hourdiff = "0"; // hours difference between server time and local time
$timeadjust = ($hourdiff * 3600);
$melbdate = date("l, F d, Y h:i a",time() + $timeadjust);
print ("$melbdate");
?>

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |