Bug #80918 [NEW]: Create from format does'nt work for february
From: steven dot woelk at papendorf dot info
Operating system: Windows
PHP version: Irrelevant
Package: Date/time related
Bug Type: Bug
Bug description:Create from format does'nt work for february
Description:
------------
---
From manual page: https://php.net/datetime.createfromformat
---
Consider a script with the following line:
$currentDate = \DateTime::createFromFormat('Y-m', $something);
Most time it will work but for 2021-02 for instance the returned value
would be 2021-03-02 11:51:47.000000.
This is not a timestamp in february 2021.
Test script:
---------------
$currentDate = \DateTime::createFromFormat('Y-m', '2021-02');
Expected result:
----------------
$currentDate = \DateTime::createFromFormat('Y-m', '2021-02');
$currentDate->format('Y-m') === '2021-02'
Actual result:
--------------
$currentDate = \DateTime::createFromFormat('Y-m', '2021-02');
$currentDate->format('Y-m') === '2021-03'
--
Edit bug report at https://bugs.php.net/bug.php?id=80918&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80918&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80918&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80918&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80918&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80918&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80918&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80918&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80918&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80918&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80918&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80918&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80918&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80918&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80918&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80918&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80918&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80918&r=mysqlcfg
Thread (2 messages)
- steven dot woelk at papendorf dot info