Bug #79403 [NEW]: DateTime::construct inconsistent results with "first day of"
From: nfoskett at internode dot on dot net
Operating system: Linux
PHP version: 7.4.4
Package: Date/time related
Bug Type: Bug
Bug description:DateTime::construct inconsistent results with "first day of"
Description:
------------
When using "first day of" relative time formats, the constructor gives
inconsistent values for what ought to be the same. Results shown below
are all as of 2020-03-22 03:49:52.
Test script:
---------------
$month_start = new DateTime("first day of this month");
echo $month_start->format('Y-m-d H:i:s') . "\n";
$month_start = new DateTime("first day of March");
echo $month_start->format('Y-m-d H:i:s') . "\n";
https://3v4l.org/lG3GL
Expected result:
----------------
2020-03-01 00:00:00
2020-03-01 00:00:00
or possibly
2020-03-01 03:49:52
2020-03-01 03:49:52
Actual result:
--------------
2020-03-01 03:49:52
2020-03-01 00:00:00
--
Edit bug report at https://bugs.php.net/bug.php?id=79403&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79403&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79403&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79403&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79403&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79403&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79403&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79403&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79403&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79403&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79403&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79403&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79403&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79403&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79403&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79403&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79403&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79403&r=mysqlcfg
Thread (4 messages)
- nfoskett at internode dot on dot net