RE: Simple Time Question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm



On 21 October 2004 18:01, Robert Cummings wrote:

> On Thu, 2004-10-21 at 12:25, Ford, Mike wrote:
> > To view the terms under which this email is distributed,
> please go to http://disclaimer.leedsmet.ac.uk/email.htm
> > 
> > 
> > 
> > On 21 October 2004 15:49, Ben Miller wrote:
> > 
> > > Probably a stupid question, but hopefully has a simple answer.  Is
> > > there a way to get Grenwich Mean time?  time() and date()
> > > functions that I can see only seem to get date/time from the
> > > server, which knowing where that is, could easily figure out GM
> > > time, but.... would rather go the other way.
> > 
> > time() returns a UNIX timestamp which, by definition, is always in
> > GMT. 
> 
> No it isn't. It goes by your machine's clock.

Yes, it is.  UNIX timestamps are *always* in GMT -- here is the definition
from the PHP time() page:

> Returns the current time measured in the number of seconds since
> the Unix Epoch (January 1 1970 00:00:00 GMT).

Note that GMT on the end.

Believe me, I have researched this extensively -- you will find that the
same timestamp represents all these times:

    12:00 1-Dec-2004 GMT (London, England)
    07:00 1-Dec-2004 -0500 (New York)
    20:30 1-Dec-2004 +0830 (Darwin, Australia)

and so on.

It is date() and mktime() that do the conversion to and from the server's
local timezone, including DST adjustments where necessary.  The timestamp is
timezone agnostic.

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Headingley Campus, LEEDS,  LS6 3QS,  United Kingdom
Email: m.ford@xxxxxxxxxxxxxx
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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux