Name: Stephen Allden Date: October 25, 2006 at 04:58:50 Pacific Subject: Server's Time! OS: Win XP Home CPU/Ram: 3.06Ghz, 512MB RAM Model/Manufacturer: Acer, SA85
Comment:
Hiya Does Anyone Know How I Can Get This Javascipt To Use The Website's Server Time Instead of the user's system time.
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?
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.
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"); ?>
The information on Computing.Net is the opinions of its users. Such
opinions may not be accurate and they are to be used at your own risk.
Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE