Bug #12474 Updated: possible incorrect strtotime handling of "-1Month"
| From: | derick@php.net | Date: | Sat, 25 May 2002 10:29:59 +0000 |
| Subject: | Bug #12474 Updated: possible incorrect strtotime handling of "-1Month" | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-8495@lists.php.net to get a copy of this message | ||
ID: 12474
Updated by: derick@php.net
Reported By: jbarrett@australink.net
-Status: Open
+Status: Closed
Bug Type: Date/time related
Operating System: Linux (should happen on any)
PHP Version: 4.0.4pl1
New Comment:
Not really a bug, it's exactly like GNU date behaves:
[derick@kossu derick]$ date --date='31 July 2001 -1 month'
Sun Jul 1 00:00:00 CEST 2001
Previous Comments:
------------------------------------------------------------------------
[2001-12-20 03:48:28] lobbin@php.net
Confirmed with php 4.2.0-dev.
print date("d/m/Y", strtotime("1 month ago", strtotime("31 July
2001")))."\n";
Gives the same error, and that should be correct GNU date syntax?
R.
------------------------------------------------------------------------
[2001-07-30 20:53:49] jbarrett@australink.net
when running
<?PHP
print date("d/m/Y", strtotime("31 July 2001"))."\n";
print date("d/m/Y", strtotime("-1 month", strtotime("31 July
2001")))."\n";
?>
it replies with
X-Powered-By: PHP/4.0.3pl1
Content-type: text/html
31/07/2001
01/07/2001
of course what it's doing is turning it into 31 june which is then
being considered to be the 1 of july.. Should this be right or should
strtotime realise that there are 30 days in june and truncate the
"31st" day?
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=12474&edit=1