|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2018-10-27 18:41 UTC] requinix@php.net
-Package: PHP Language Specification
+Package: Date/time related
[2018-10-27 18:41 UTC] requinix@php.net
[2019-02-11 19:25 UTC] duncan3dc@php.net
[2021-04-06 18:43 UTC] derick@php.net
-Status: Open
+Status: Not a bug
[2021-04-06 18:43 UTC] derick@php.net
[2021-04-06 20:08 UTC] php4fan at gmail dot com
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 09:00:01 2025 UTC |
Description: ------------ A DateInterval object can represent negative intervals, when its $invert property equals 1. However, there's no way (or no documented way) to construct a DateInterval object that is inverted with the constructor. Yoy need to do: $interval = new DateInterval("whatever"); $interval->inverted = 1; It's absolutely ridiculous and pathetic that there exist values that can be represented by the class but cannot be created with the constructor. The interval_spec should support a way to specify inverted intervals. Any of these would be fine, it's just a matter of taste: - prefix the interval with a "-" (minus) sign e.g. "-P1Y3D" - a "-" (minus) sign after the initial P e.g. "P-1Y3D" - some suffix at the end, for example "I" for "Inverted" e.g. "P1Y3DN"