> -----Original Message-----
> From: Jens Lehmann [mailto:[EMAIL PROTECTED]]
> Sent: 27 May 2002 12:48
> > > -----Original Message-----
> > > From: Jens Lehmann [mailto:[EMAIL PROTECTED]]
> > > Sent: 24 May 2002 20:31
> > >
> > > time() returns the number of seconds since the Unix Epoch to
> > > the current
> > > local time
> > >
> > > gmtime() should return the number of seconds since the Unix
> > > Epoch to the
> > > current GM-time
> > >
> > > Do you understand now?
> > Uh, no, actually now I'm more confused!
> I can understand that you're confused. :-) Or am I?
> > As I understand it, a Unix timestamp is *always* the number
> > of seconds since 1-Jan-1970 GMT ("the Unix epoch"), and
> > so is always a GMT time.
> Imho no, because 1-Jan-1970 GMT is just the "starting point",
> the result depends on which timezone your server is located in.
> Please correct me if I'm wrong here!

Well, I'm not sure, because I think we're talking at cross purposes.  I'm *still* not 
sure what you want gmtime() to achieve that's different from time(), because, as far 
as I can see, the two scenarios you describe above actually return the same value.  
Or, to put it another way, because a timestamp is *always in GMT*, it returns the time 
since 1-Jan-1970 00:00:00, full stop, period, end of story.  In other words, 
timestamps operate in a single timezone, and it's up to anything else that works with 
a timestamp to do the timezone (and daylight-savings) corrections.  (This is also why 
you get the anomaly of 23- and 25-hour days in areas which have daylight-savings 

Let's take some detailed examples, and maybe you can explain what you're trying to get 
with your gmtime() (and why!):

In a purely GMT zone, with local time 27-May-2002 12:00:00, the UNIX timestamp is 

In a nominally GMT zone, but with daylight-savings in effect (such as British Summer 
Time!), with local time 27-May-2002 13:00:00, the UNIX time stamp for this is also 

Likewise, in a GMT+0200 zone, a local time of 27-May-2002 14:00:00 also gives a 
timestamp of 1022500800.

In fact, this same timestamp of 1022500800 also represents all of these local times:

    27-May-2002 04:00 -0800
    27-May-2002 07:00 -0500
    27-May-2002 17:00 +0500
    27-May-2002 23:00 +1100

and even such oddities as:

    27-May-2002 21:30 (Western Australia / Northern Territory)

Thus, given the timestamp of 1022500800, it's the job of date() to determine the 
correct timezone and daylight-savings offset and apply them before formatting the 
output; gmdate() just formats it without applying any offsets.  Likewise, mkdate() and 
gmmkdate() translate the other way respectively with and without timezone correction.

Forgive me if I've gone on at what seems like excessive length, but I just wanted to 
make sure we both know exactly what it is we're talking about!



Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to