Bug #75038 [NEW]: datetime error
| From: | marco dot delcorto at genesi-software dot it | Date: | Fri, 04 Aug 2017 17:24:08 +0000 |
| Subject: | Bug #75038 [NEW]: datetime error | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-210483@lists.php.net to get a copy of this message | ||
From: marco dot delcorto at genesi-software dot it
Operating system: Windows 7
PHP version: 5.6.31
Package: *General Issues
Bug Type: Bug
Bug description:datetime error
Description:
------------
---
From manual page: http://www.php.net/datetime.add
---
using the script in the example:
$date = new DateTime('2369-12-30');
$date->add(new DateInterval('P1D'));
echo $date->format('Y-m-d');
the result is '2370-01-00' (wrong), instead of '2369-12-31'
Same problem if we use:
$dateW2 = new DateTime('2369-12-31');
echo date_format($dateW2, 'Y-m-d');
the result is '2370-01-00' (wrong), instead of '2369-12-31'
Test script:
---------------
$date = new DateTime('2369-12-30');
$date->add(new DateInterval('P1D'));
echo $date->format('Y-m-d') . "\n";
$dateW2 = new DateTime('2369-12-31');
echo date_format($dateW2, 'Y-m-d');
--
Edit bug report at https://bugs.php.net/bug.php?id=75038&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75038&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75038&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75038&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=75038&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=75038&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=75038&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=75038&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=75038&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=75038&r=support
Expected behavior: https://bugs.php.net/fix.php?id=75038&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=75038&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=75038&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=75038&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75038&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=75038&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=75038&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=75038&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=75038&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=75038&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=75038&r=mysqlcfg