Bug #68317 [Opn->Csd]: DateInterval hour eqal -1

From: Date: Tue, 28 Oct 2014 12:46:39 +0000
Subject: Bug #68317 [Opn->Csd]: DateInterval hour eqal -1
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-188341@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68317&edit=1 ID: 68317 User updated by: romain dot chanu at ac-clermont dot fr Reported by: romain dot chanu at ac-clermont dot fr Summary: DateInterval hour eqal -1 -Status: Open +Status: Closed Type: Bug Package: Date/time related Operating System: Ubuntu PHP Version: 5.5.18 Block user comment: N Private report: N New Comment: The problem is using diff with CEST date and a CET date. My bad. Sorry for any inconvenience this may cause. Previous Comments: ------------------------------------------------------------------------ [2014-10-28 12:28:05] romain dot chanu at ac-clermont dot fr 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 this bug report at https://bugs.php.net/bug.php?id=68317&edit=1

« previous php.bugs (#188341) next »