Bug #15194 Updated: date("m-d-y H:m:s", $timestamp) doesn't jive with system time
| From: | eru@php.net | Date: | Tue, 02 Jul 2002 20:33:50 +0000 |
| Subject: | Bug #15194 Updated: date("m-d-y H:m:s", $timestamp) doesn't jive with system time | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-12861@lists.php.net to get a copy of this message | ||
ID: 15194
Updated by: eru@php.net
Reported By: emetsger@jhu.edu
-Status: Open
+Status: Bogus
Bug Type: Date/time related
Operating System: Solaris 7
PHP Version: 4.1.1
New Comment:
Thank you for taking the time to report a problem with PHP.
Unfortunately your version of PHP is too old -- the problem
might already be fixed. Please download a new PHP
version from http://www.php.net/downloads.php
If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.
Previous Comments:
------------------------------------------------------------------------
[2002-07-02 16:26:09] gg3po@hotmail.com
Addionally, I've descovered that when PHP gets a timestamp from a UNIX
file that was created/modified on the first
day of any month ( use ls -al from the command line to verify the
actual date modified), PHP returns the mday (in the case of getdate()),
or "d" (in the case of date()) as being the last day of the PREVIOUS
month + 1 day, instead of returning 1, which is the actual day of
modification/creation. It doesn't even try to claim it's day 0. It
just invents an imaginary day for the previous month and returns that.
It also gets the "m" (date()), or 'mon' and 'month' (getdate())
values wrong, returning them as those of the previous month. Try using
date("m - d", $timestamp_from_unix_file); if you don't believe me.
BTW, the $timestamp_from_unix_file in the example above, actually has
to be FROM a REAL unix file, not a PHP
generated unix timestamp. Use filemtime($filename) to get it.
------------------------------------------------------------------------
[2002-01-24 00:19:16] emetsger@jhu.edu
calling date("m-d-y H:m:s", $timestamp) doesn't always produce the
correct system date.
The linked page and source demonstrate this problem.
The date is gathered from three different sources on the system: the
date command, the date within mysql, and the php time() function call.
The three different sources all produce identical timestamps. However,
when I call the date() function with the above timestamp, the system
date will not match the formatted date returned by date().
I saw this problem orginally in my 4.0.6 install, and just upgraded to
4.1.1 and my test page still exhibits the same behavior.
The page is located at: http://esm.mse.jhu.edu/cms/test/testdate.php
The source is at:
http://esm.mse.jhu.edu/cms/test/testdate.phps
My phpinfo page is at:
http://esm.mse.jhu.edu/cms/test/index.php
Thanks for taking a look!
Elliot Metsger
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=15194&edit=1