note 130623 added to class.dateinterval
| From: | eof@tty3.dev | Date: | Sat, 24 Jan 2026 04:30:20 +0000 |
| Subject: | note 130623 added to class.dateinterval | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-222513@lists.php.net to get a copy of this message | ||
I typically ignore the comments section on php.net; however, I should note that it is wrong to even
attempt comparison between date intervals by adding them to a zero date because PHP's date
intervals are stored in ambiguous units of time (days, months, and years are not regular).
a correct date interval is stored in terms of seconds (plus integer microseconds, typically) between
the two dates. any more coarse measurement for approximate purposes is then derived from the
interval.
just skip this entirely, and write your own interval type based on the above, from first principals.
it's easy.
----
Server IP: 206.189.2.9
Probable Submitter: 69.9.132.73
----
Manual Page -- https://php.net/manual/en/class.dateinterval.php
Edit -- https://main.php.net/note/edit/130623
Del: integrated -- https://main.php.net/note/delete/130623/integrated
Del: useless -- https://main.php.net/note/delete/130623/useless
Del: bad code -- https://main.php.net/note/delete/130623/bad+code
Del: spam -- https://main.php.net/note/delete/130623/spam
Del: non-english -- https://main.php.net/note/delete/130623/non-english
Del: in docs -- https://main.php.net/note/delete/130623/in+docs
Del: other reasons-- https://main.php.net/note/delete/130623
Reject -- https://main.php.net/note/reject/130623
Search -- https://main.php.net/manage/user-notes.php