#22935 [Opn->Bgs]: Date function is 16 hours off

From: Date: Thu, 27 Mar 2003 22:12:49 +0000
Subject: #22935 [Opn->Bgs]: Date function is 16 hours off
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-36618@lists.php.net to get a copy of this message
ID: 22935 Updated by: rasmus@php.net Reported By: james_clent at splwg dot com -Status: Open +Status: Bogus Bug Type: Date/time related Operating System: WIN2000 PHP Version: 4.3.0 New Comment: Well, your expectation is wrong. Unix timestamps, which is what you are using, are timezone neutral. That means that a timestamp of 3600 refers to the same moment in history, not the same time. Therefore date("H:i:s",3600) is going to give you a different answer depending on which timezone you are in. Previous Comments: ------------------------------------------------------------------------ [2003-03-27 16:05:36] james_clent at splwg dot com No that is not what I want. I do exactly what I want to do and expect to get back 0:00:01 as it should. When I give DATE("H:i:s", 3600) it returns 17:00:00. I'm trying to display the elapse time between to timestamps (standard UNIX MKTIME values). I just simplified your error for you, because the difference in MKTIME timestamps is in seconds. ------------------------------------------------------------------------ [2003-03-27 15:42:17] rasmus@php.net You probably want gmdate() if you are expecting it to return the GMT epoch ------------------------------------------------------------------------ [2003-03-27 15:29:57] james_clent at splwg dot com When doing this simple function date("H:i:s",1) php returns 16:00:01. Testing with other values still finds this issue. Haven't seen this as reported out there so assume 4.3.1 has same bug still. Thank you, James ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=22935&edit=1

« previous php.bugs (#36618) next »