Bug #78355 [NEW]: Getting the last day of a given month failing at months of 31 days
| From: | belbayar at mobicom dot mn | Date: | Wed, 31 Jul 2019 02:11:15 +0000 |
| Subject: | Bug #78355 [NEW]: Getting the last day of a given month failing at months of 31 days | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-222021@lists.php.net to get a copy of this message | ||
From: belbayar at mobicom dot mn
Operating system: Centos 7
PHP version: 7.3Git-2019-07-31 (Git)
Package: Date/time related
Bug Type: Bug
Bug description:Getting the last day of a given month failing at months of 31 days
Description:
------------
I have a problem like this. For a given date I need to get the last day
of the previous month.
For example
today is 2019-07-31, I needed date is 2019-06-30
Test script:
---------------
echo date('Y-m-t', strtotime("2019-07-31" . '-1 months'));
echo date("Y-m-d", strtotime("-1 Month"));
Expected result:
----------------
2019-07-31
2019-07-01
Actual result:
--------------
2019-06-30
2019-06-01 or 2019-06-30
--
Edit bug report at https://bugs.php.net/bug.php?id=78355&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=78355&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=78355&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=78355&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=78355&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=78355&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=78355&r=support
Expected behavior: https://bugs.php.net/fix.php?id=78355&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=78355&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=78355&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=78355&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=78355&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=78355&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=78355&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=78355&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=78355&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=78355&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=78355&r=mysqlcfg