Bug #76945 [Opn]: DateTime modify with decimals

From: Date: Fri, 28 Sep 2018 12:13:05 +0000
Subject: Bug #76945 [Opn]: DateTime modify with decimals
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-217266@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=76945&edit=1 ID: 76945 Updated by: salathe@php.net Reported by: wijnand at samson-it dot nl Summary: DateTime modify with decimals Status: Open Type: Bug Package: Date/time related PHP Version: 7.2.10 Block user comment: N Private report: N New Comment: > It's not documented The relative date/time statements (and how they behave with non-relative statements) are documented at http://php.net/manual/en/datetime.formats.relative.php Previous Comments: ------------------------------------------------------------------------ [2018-09-28 11:43:49] wijnand at samson-it dot nl Description: ------------ --- From manual page: http://www.php.net/datetime.modify --- Let's modify a DateTime object, say "add one-and-a-half hour". The expected result is that 1 hour and 30 minutes are added. The actual result is that 5 hours are added. It's not necessarily a problem that the decimal syntax is not supported, however there's no warning that this doesn't work. It's not documented and the call is happily accepted. I would say that the regex should be "\+\d+" or something along those lines. Test script: --------------- (new DateTime('2000-01-01 0:00'))->modify('+1.5 hours'); ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=76945&edit=1

« previous php.bugs (#217266) next »