Computing.Net > Forums > Web Development > Server's Time!

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Server's Time!

Reply to Message Icon

Name: Stephen Allden
Date: October 25, 2006 at 04:58:50 Pacific
OS: Win XP Home
CPU/Ram: 3.06Ghz, 512MB RAM
Product: 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.

http://www.stephenallden.co.uk/java...

Cheers!!! :-)



Sponsored Link
Ads by Google

Response Number 1
Name: Michael J (by mjdamato)
Date: October 25, 2006 at 07:11:25 Pacific
Reply:

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


0

Response Number 2
Name: Michael J (by mjdamato)
Date: October 25, 2006 at 07:21:13 Pacific
Reply:

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


0

Response Number 3
Name: fleetmack
Date: October 25, 2006 at 14:14:22 Pacific
Reply:

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");
?>


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: Server's Time!

Do I have to buy??? www.computing.net/answers/webdevel/do-i-have-to-buy/1092.html

Auto Responders www.computing.net/answers/webdevel/auto-responders/987.html

cant access webpage outside lan ..? www.computing.net/answers/webdevel/cant-access-webpage-outside-lan-/3045.html