isSameDay.php
Table of Contents
Functions
- isSameDay() : bool
- Tells whether two instants fall on the same calendar day.
Functions
isSameDay()
Tells whether two instants fall on the same calendar day.
isSameDay(DateTimeInterface $a, DateTimeInterface $b[, DateTimeZone|null $timezone = null ]) : bool
The same physical instant can be a different calendar date depending on the timezone
it is read in — 2026-01-01 00:30:00 UTC is still 2025-12-31 in America/Los_Angeles.
Both dates are converted to $timezone before their calendar date is compared ; it
defaults to the timezone carried by $a, so the common, no-argument call answers
"is $b the same day as $a, as seen from $a's own timezone". Pass $timezone
explicitly to compare from a third, unrelated timezone instead.
Parameters
- $a : DateTimeInterface
-
The first instant.
- $b : DateTimeInterface
-
The second instant.
- $timezone : DateTimeZone|null = null
-
The timezone the comparison is made in. Defaults to
$a's own timezone.
Tags
Return values
bool —true if $a and $b fall on the same calendar day in $timezone, false otherwise.