Bug #75606 [Opn->Nab]: strtotime("first day this month") vs strtotime("first day of this month")
| From: | requinix@php.net | Date: | Fri, 01 Dec 2017 07:29:07 +0000 |
| Subject: | Bug #75606 [Opn->Nab]: strtotime("first day this month") vs strtotime("first day of this month") | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-212853@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=75606&edit=1
ID: 75606
Updated by: requinix@php.net
Reported by: rafal dot janiczek at gmail dot com
Summary: strtotime("first day this month") vs
strtotime("first day of this month")
-Status: Open
+Status: Not a bug
Type: Bug
Package: Date/time related
Operating System: Linux
PHP Version: 7.1.12
Block user comment: N
Private report: N
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
That's right, "last day" and "last day of" do different things.
http://php.net/manual/en/datetime.formats.relative.php
Previous Comments:
------------------------------------------------------------------------
[2017-11-30 21:31:18] rafal dot janiczek at gmail dot com
Description:
------------
strtotime("first day this month") gives a date for next month.
Test script:
---------------
<?php
$d = "first day this month";
echo "'$d': ".date("Y-m-d", strtotime($d)).PHP_EOL;
$d = "first day of this month";
echo "'$d': ".date("Y-m-d", strtotime($d)).PHP_EOL;
echo "Today: ".date("Y-m-d").PHP_EOL;
Expected result:
----------------
'first day this month': 2017-11-01
'first day of this month': 2017-11-01
Today: 2017-11-30
Actual result:
--------------
'first day this month': 2017-12-01
'first day of this month': 2017-11-01
Today: 2017-11-30
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75606&edit=1