Hướng dẫn php compare dateinterval
DateTimeImmutable::diffDateTime::diffdate_diff(PHP 5 >= 5.3.0, PHP 7, PHP 8) DateTimeInterface::diff -- DateTimeImmutable::diff -- DateTime::diff -- date_diff — Returns the difference between two DateTime objects DescriptionObject-oriented style Parametersdatetime The date to compare to. absolute Should the interval be forced to be positive? Return ValuesThe 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. |