Bug #15194 Updated: date("m-d-y H:m:s", $timestamp) doesn't jive with system time
| From: | eru@php.net | Date: | Wed, 03 Jul 2002 18:10:11 +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-13019@lists.php.net to get a copy of this message | ||
ID: 15194
Updated by: eru@php.net
Reported By: emetsger@jhu.edu
Status: Feedback
Bug Type: Date/time related
Operating System: Solaris 7
PHP Version: 4.2.1
New Comment:
Sorry, but I couldn't reproduce this on my 5.8 system.
I did
touch -am -t 200203011200 timestamp.dat
timestamp.php is
<pre>
<?php
$timestamp = filemtime( "timestamp.dat" );
var_dump( $timestamp );
var_dump( date( "Y.m.d" , $timestamp ) );
var_dump( getdate( $timestamp ) );
?>
</pre>
output is
int(1014980400)
string(10) "2002.03.01"
array(11) {
["seconds"]=>
int(0)
["minutes"]=>
int(0)
["hours"]=>
int(12)
["mday"]=>
int(1)
["wday"]=>
int(5)
["mon"]=>
int(3)
["year"]=>
int(2002)
["yday"]=>
int(59)
["weekday"]=>
string(6) "Friday"
["month"]=>
string(5) "March"
[0]=>
int(1014980400)
}
so, everything looks ok by me.
As I'm still not able to see your code, are you _sure_ that you're not
making any errors?
Previous Comments:
------------------------------------------------------------------------
[2002-07-03 12:53:42] eru@php.net
That was the purpose of my bugusifying of the report, to get an update
from you. Please take a look at the message ;-)
Anyway, your pages only yield a 403 Forbidden, so please grant access,
so that I can verify the bug. :-)
Thanks for helping!
------------------------------------------------------------------------
[2002-07-03 12:48:48] emetsger@jhu.edu
Changed status back to Open.
------------------------------------------------------------------------
[2002-07-03 12:45:30] emetsger@jhu.edu
Please do not call this bug bogus. I submitted this bug in 2001, and
since then I have upgraded to 4.2.1 as listed in my phpinfo() page.
The test links have been updated to work properly, and the bug still
exhibits the buggy behavior.
------------------------------------------------------------------------
[2002-07-02 16:33:50] eru@php.net
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.
------------------------------------------------------------------------
[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.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/15194
--
Edit this bug report at http://bugs.php.net/?id=15194&edit=1