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/