Bug #75606 [NEW]: strtotime("first day this month") vs strtotime("first day of this month")
| From: | rafal dot janiczek at gmail dot com | Date: | Thu, 30 Nov 2017 21:31:19 +0000 |
| Subject: | Bug #75606 [NEW]: strtotime("first day this month") vs strtotime("first day of this month") | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-212849@lists.php.net to get a copy of this message | ||
From: rafal dot janiczek at gmail dot com
Operating system: Linux
PHP version: 7.1.12
Package: Date/time related
Bug Type: Bug
Bug description:strtotime("first day this month") vs strtotime("first day of this
month")
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 bug report at https://bugs.php.net/bug.php?id=75606&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75606&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75606&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75606&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=75606&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=75606&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=75606&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=75606&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=75606&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=75606&r=support
Expected behavior: https://bugs.php.net/fix.php?id=75606&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=75606&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=75606&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=75606&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75606&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=75606&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=75606&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=75606&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=75606&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=75606&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=75606&r=mysqlcfg