note 46786 deleted from function.time by aidan

From: Date: Sat, 08 Oct 2005 01:05:07 +0000
Subject: note 46786 deleted from function.time by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-96624@lists.php.net to get a copy of this message
Note Submitter: edsarkiss-at-yahoo-dot-com ---- jonatan -- as the docs state, the time() function already returns the "number of seconds since the UNIX epoch -- Jan 1 1970 00:00:00 GMT". by applying the local timezone offset to time(), you are actually moving out of GMT. Here are some things to keep in mind: 1) if you're dealing in UNIX timestamps, the figure is ALWAYS in GMT. There is no notion of timezone in UNIX timestamps. This is merely a counter of the number of seconds since the epoch. Timezone is irrelevant. There is no such thing as a UNIX timestamp that is in a different timezone. 2) if you need to convert this to a localized time, then use localtime(time()). This returns an array of values you may then manipulate or pass to other functions like .... 3) mktime() returns a UNIX timestamp, which means that this is ALWAYS in GMT. The timezone/dst values that you pass in are taken into consideration, but the value that comes out is a UNIX timestamp, hence, GMT. see (1) above. I actually think someone should remove the post from jonatan below, as it is misleading. I know many engineers (myself included) who are confused by UNIX timestamps at first.

« previous php.notes (#96624) next »