nextTimeOfDay.php
Table of Contents
Functions
- nextTimeOfDay() : DateTimeImmutable
- Finds the next moment a given time of day comes round, strictly after another.
Functions
nextTimeOfDay()
Finds the next moment a given time of day comes round, strictly after another.
nextTimeOfDay(string $time, DateTimeInterface $after) : DateTimeImmutable
A limit written as an hour — « stop starting work at 05:30 » — means the next 05:30, whatever the moment it is read: the same day when that hour is still ahead, the next day when it has passed or is now. A job started at 23:00 and one started at 02:00 the same night both stop at half past five the next morning.
The moment is taken in the timezone of $after. On the day the clocks go forward, an hour that
does not exist is moved on by PHP: 02:30 in Paris on the last Sunday of March is 03:30.
Parameters
- $time : string
-
The time of day,
HH:MM, from00:00to23:59. - $after : DateTimeInterface
-
The moment it must come strictly after.
Tags
Return values
DateTimeImmutable —The next moment it is $time.