Bug #68317 [NEW]: DateInterval hour eqal -1
| From: | romain dot chanu at ac-clermont dot fr | Date: | Tue, 28 Oct 2014 12:28:06 +0000 |
| Subject: | Bug #68317 [NEW]: DateInterval hour eqal -1 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-188339@lists.php.net to get a copy of this message | ||
From: romain dot chanu at ac-clermont dot fr
Operating system: Ubuntu
PHP version: 5.5.18
Package: Date/time related
Bug Type: Bug
Bug description:DateInterval hour eqal -1
Description:
------------
---
From manual page: http://www.php.net/class.dateinterval
---
Hi,
My PHP version is : 5.5.9-1ubuntu4.4
My application uses a function for calculating the difference in second
between 2 DateTime(from string) using the "diff" method. It returns a
DateInterval. It works fine but it seems DateInterval->h is not able to
be equal to 23... When h property should be equal to 23 I got a "-1".
It seems very weird to got "-1"!
Test script:
---------------
$beginDate = new DateTime();
$endDate = new DateTime(); //24/10/2014 a 13h20
$stringDate = "24/10/2014 a 13h30";
$endDate = DateTime::createFromFormat('d/m/Y \a H\hi', $stringDate);
$diffDate = $endDate->diff($beginDate); //3 days 23 h 50m
echo "hours : $diffDate->h";
//returns hours : -1
--
Edit bug report at https://bugs.php.net/bug.php?id=68317&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=68317&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=68317&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=68317&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=68317&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=68317&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=68317&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=68317&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=68317&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=68317&r=support
Expected behavior: https://bugs.php.net/fix.php?id=68317&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=68317&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=68317&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=68317&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68317&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=68317&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=68317&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=68317&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=68317&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=68317&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=68317&r=mysqlcfg