2 different time zones

From: Brian (usenet3_at_julietremblay.com.invalid)
Date: 09/29/04


Date: Wed, 29 Sep 2004 20:54:26 GMT

I have 4 sites sharing an account on a server that is in the US Eastern
time zone. 3 of those sites are for businesses/persons who live in the
same time zone, but one is for a restaurant in the US Pacific time zone.

For that site, I want to generate content via a script depending on the
local Pacific time and day of week. The content will change at the same
time every day: one page before 5:00am local time, a different page from
5am until 10pm, then back to the first page after 10pm. The script
should also generate appropriate last modified and expires headers. It'd
be nice if this script were portable, in case I change hosting companies
and wind up with a host in European time, or US central time, or what
have you.

At the moment, my script gets the local time of the server (US ET),
converts it to UT with date("Z"), then converts it again to Pacific time:

$utTimeStamp = time() - date("Z");
$daylightSavingsTime = date("I");
$PT = $utTimeStamp - (8*3600) + ($daylightSavingsTime*3600);

That's fine for the current time, but trying to work out expires times
seems rather complicated, and I'm having a hard time getting everything
to work. Is there an easier way to accomplish my tasks? Should I give up
some portability and simply convert from one local time to another?

-- 
Brian  (remove "invalid" to email me)
http://www.tsmchughs.com/


Relevant Pages

  • Re: Date problem
    ... If a JavaScript function determines the local time ... that local time zone down to the server somehow ... ... I have users who are located in this time zone and in time zones ...
    (comp.lang.php)
  • Re: How to compare DateTime Objects?
    ... If the server records in GMT ... It does not matter what time zone the ... server is actually in as long as it records in UTC. ... display based on their local time. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: timezone missing for ftp transfers...
    ... >> FTP server have the wrong time when they are saved to ... What is the client that is in use here? ... >local time zone of the server - which means that they are ...
    (microsoft.public.inetserver.iis.ftp)
  • Re: email time sync problems.
    ... It's probably not the server since that's only geared up for one time. ... The clients have a local time, local time zone and Outlook time zone. ...
    (microsoft.public.exchange.misc)
  • Re: list all users created today
    ... Here is the script i am currently using - how can i include the "where ... and Local is the local time (in your time zone). ... don't matter, but if you are searching for objects created since midnight, ...
    (microsoft.public.windows.server.scripting)