Re: 2 different time zones
From: Brian (usenet3_at_julietremblay.com.invalid)
Date: 09/30/04
- Next message: Brian: "Re: Nasty Values :-)"
- Previous message: Andy Hassall: "Re: how to use convert_uuencode()"
- Maybe in reply to: Brian: "Re: 2 different time zones"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 30 Sep 2004 20:33:59 GMT
Alvaro G. Vicario wrote:
> *** Brian escribió/wrote (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.
>
>
> I believe this task is usually solved using GMT internally for all
> dates and doing conversion to client time zone when printing. You
> have some functions to work with Greenwich time:
>
> gmdate - Format a GMT/UTC date/time
> gmmktime - Get UNIX timestamp for a GMT date
> gmstrftime - Format a GMT/UTC time/date according to locale settings
The documentation for gm* date functions on php.net is not terribly
clear to me. gmmktime gets a unix timestampe for a GMT date, but I need
to determine what to do based on a local time zone, and account for
daylight savings. That's complicated by the fact that the server's
localtime is not the restaurant's local time. I need to set an expires
header based on the local time of the restaurant, but the time must be
expressed in GMT. 2 examples:
1. if it's between 05:00 and 22:00 US PT, the page should insert that
day's dinner special, and the expires header should be set to 22:00
local time. Since US PT is currently in daylight savings (GMT -0700),
that means that for today, Thursday 30 September 2004, it should be
Expires: Fri, 01 Oct 2004 05:00:00 GMT
2. if it's after 22:00, the page should not show the special, and the
page should expire the next day at 05:00. The expires header should thus be
Expires: Fri, 01 Oct 2004 12:00:00 GMT
What I find difficult is doing date calculations, while at the same time
having to hardcode the time. For example 2, I'm trying to determine the
current date, change it to tomorrow, and create a unix time stamp based
on tomorrow at 05:00.
I started this thread to see if I'm making this too complicated -- I
suspect that I am -- and determine if there's an easier way to work in
US PT or GMT.
-- Brian (remove "invalid" to email me) http://www.tsmchughs.com/
- Next message: Brian: "Re: Nasty Values :-)"
- Previous message: Andy Hassall: "Re: how to use convert_uuencode()"
- Maybe in reply to: Brian: "Re: 2 different time zones"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|