RE: [PHP] Simple Time Question

From: Date: Thu, 21 Oct 2004 16:25:45 +0000
Subject: RE: [PHP] Simple Time Question
Groups: php.general 
Request: Send a blank email to php-general+get-200007@lists.php.net to get a copy of this message
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. date() formats that, converting for the current timezone. gmdate() formats it without doing any timezone conversion, hence in GMT. mktime() makes a timestamp (hence in GMT) from the supplied date/time information, converting from the current timezone. gmmktime() does the same, but without any timezone conversion, so the information you supply must be in GMT. In summary: * timestamps are always in GMT. * date() and mktime() do timezone conversion. * gmdate() and gmmktime() do not. 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@leedsmet.ac.uk Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211

« previous php.general (#200007) next »