UnitedForums - UK Web Hosting Forum UnitedHosting Community Hosting Forums
Network and Server StatusCustomer SupportUK Web Hosting
UnitedHostingUnitedHosting Sitemap UK Hosting ForumUK Web HostingWeb Hosting ForumsUK Reseller HostingWeb Host CommunityUK Managed Dedicated ServersHosting Help and SupportUK Domain Name Registration

Go Back   UnitedForums.co.uk > UnitedHosting Community > Website Development & Scripting

Reply
 
Thread Tools Rate Thread Display Modes
Old 29th December 2007, 11:02 PM   #1 (permalink)
canuckster
Lumberjack and I'm okay
 
Join Date: Dec 2004
Location: Canada
Posts: 243
Server time

I've googled and searched these forums, but remain confused, so I'll just ask.

I'm writing a script which I'll eventually submit as a cron job, and it relies on knowing the date and time. When I upload my script and test it, any call to php's date() function simply shows my local time, but I'm interested in the server's time, so I can write everything properly for when this becomes a cron.

So -- if date() gets called remotely (like from my web browser), obviously it returns local time, and I'm guessing that if it's called locally on the server (cron) then it returns the server's time. If that's true, it would solve my problem, but I'd still feel better being able to call on some function to explicity check the time on the server, regardless of where the script is being called from (call it testing paranoia).

BTW I'm still on PHP 4.

Any suggestions?
canuckster is offline   Reply With Quote
Old 30th December 2007, 12:29 AM   #2 (permalink)
ngray
Registered User
 
ngray's Avatar
 
Join Date: Mar 2006
Location: The dark side of the moon
Posts: 337
Send a message via Skype™ to ngray
because PHP is executed on the server, any date/time functions will return data from the server's date/time.
__________________
Splattt there goes the 8:15 pie right on time. I hate mondays (Garfield)

If you drive you should be Smart Driving

Paranormal ghost map of the UK Thames Valley Paranormal Group
ngray is online now   Reply With Quote
Old 30th December 2007, 01:43 AM   #3 (permalink)
canuckster
Lumberjack and I'm okay
 
Join Date: Dec 2004
Location: Canada
Posts: 243
Yes, but when I test it, it shows my local time. Here's a test file to show what I mean:

http://www.visionarytennis.com/php/time.php

All it contains is this:
PHP Code:
<?

echo ('Right now it is ' date ('Y-m-d, H:i'));

?>
I'm on the gamma server, which so far as I know is located in the UK, but it shows me local Eastern Standard Time -- and I can only assume it would show local time for whatever user accesses it. What I'd like to is to be able to see the server time, even when accessing it via the web like this test page.

Does that make sense?
canuckster is offline   Reply With Quote
Old 30th December 2007, 02:19 AM   #4 (permalink)
ngray
Registered User
 
ngray's Avatar
 
Join Date: Mar 2006
Location: The dark side of the moon
Posts: 337
Send a message via Skype™ to ngray
Running a traceroute, it appears gamma is in the US. As above, PHP is run on the server so will return the date and time of the server. If the server is in the US it will return a US time.
__________________
Splattt there goes the 8:15 pie right on time. I hate mondays (Garfield)

If you drive you should be Smart Driving

Paranormal ghost map of the UK Thames Valley Paranormal Group
ngray is online now   Reply With Quote
Old 30th December 2007, 04:23 AM   #5 (permalink)
Charles
Registered User
 
Join Date: Sep 2007
Location: 17°59′N 76°48′W
Posts: 150
If the gamma server is in the US and it is in Colo4Dallas, then the server would be located in CST Zone. I am on Ranger which is in Colo4Dallas and the server time is UTC(GMT). I had asked about this being changed to CST but was told it will remain UTC. That is ok with me.

You can also do a time off set with PHP to your time zone. I have PHP scripts that do this(CubeCart). I also have a backup script but it is using the servers time which is good from a backup standpoint.

I think that in some ways it is better to have the server in UTC zone as you don't have to worry about Daylight Saving Time changes every year which is probably why ranger will remain UTC. At least I know that the time zone won't change on the server. It probably makes things easier for UH Staff when doing things on the server.
Charles is offline   Reply With Quote
Old 30th December 2007, 05:02 AM   #6 (permalink)
canuckster
Lumberjack and I'm okay
 
Join Date: Dec 2004
Location: Canada
Posts: 243
Hmmm, interesting stuff. As no one from UH has had a chance to weigh in on this thread yet, I think I'll open a ticket to clarify the situation. Thanks for all the responses!
canuckster is offline   Reply With Quote
Old 30th December 2007, 03:46 PM   #7 (permalink)
canuckster
Lumberjack and I'm okay
 
Join Date: Dec 2004
Location: Canada
Posts: 243
Well Matt has solved my confusion -- gamma is, in fact, in the U.S. and following Eastern Standard/Daylight Time.
canuckster is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


All times are GMT. The time now is 08:33 PM.

UK Web Hosting  |  UK Reseller Hosting  |  UK Dedicated Servers UnitedHosting  |  UnitedSupport  |  UnitedForums  |  SEO by vBSEO 3.0.0
Copyright © 1998-2008 United Communications Limited. All Rights Reserved. Registered in England and Wales 3651923 - VAT Reg No. 737662309