Hướng dẫn date diff php
(PHP 5 >= 5.3.0, PHP 7, PHP 8) DateTimeInterface::diff -- DateTimeImmutable::diff -- DateTime::diff -- date_diff — Returns the difference between two DateTime objects Object-oriented style The date to
compare to. Should the interval be forced to be positive? The DateInterval object represents the difference between the two dates. The return value more specifically represents the clock-time interval to apply to the original object ( The method is aware of DST changeovers, and hence can return an interval of
ExamplesExample #1 DateTimeImmutable::diff() example Object-oriented style
Procedural style
The above examples will output: Example #2 DateTimeInterface::diff() during DST changeover
The above example will output: Example #3 DateTime object comparison
The above example will output: bool(false) bool(true) bool(false) See Also
There are no user contributed notes for this page. |