Re: 2 different time zones

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


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/


Relevant Pages

  • Re: TimeZone conversion and utils on PPC
    ... SystemTimeToLocalTime and LocalTimeToSystemTime are both available. ... local time always takes into account the current time zone, ... Local including taking into account any Daylight offsets? ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: getTime, setTime, recent change in daylight savings
    ... there to account for the user being in a different time zone? ... Date checks the local time, ... something OS-level. ...
    (comp.lang.javascript)
  • Re: User Logon and Account Expiration Date
    ... in UTC and converts to the time zone of the user (probably the time zone of ... onto a machine in the Pacific time zone, the UTC value will convert to ... If a DC receive a logon request for a user account, ...
    (microsoft.public.windows.server.active_directory)
  • Re: OpenMPE redux, executive view.
    ... and have everyone see everything in their local time. ... [time zone variable set for time zone where the system is located] ... Current value of Time Zonevariable: PST8PDT ... Notice the CTIME function returns the Pacific time according to the ...
    (comp.sys.hp.mpe)
  • Re: WMI LastBootUpTime wrong value
    ... To convert to local time you need to adjust using ... the time zone bias stored in the local registry. ... ' Obtain local Time Zone bias from machine registry. ...
    (microsoft.public.scripting.vbscript)