Time offsets¶
This is a value retrieved from a point in time and is expressed in a number of hours and minutes.
$offset->hours()
returns anint
between-12
and14
$offset->minutes()
returns anint
between0
and59
Via this object you cannot know in which timezone you're in. If you need to keep track of this you should model this in your program and not rely on this information.
When you have access to a PointInTime
you can change its offset like this:
use Innmind\TimeContinuum\{
Clock,
Offset,
};
$utc = Clock::live()->now();
$newYork = $utc->changeOffset(Offset::minus(5));
If $utc
represents '2024-11-24T14:25:00+00:00'
then $newYork
represents '2024-11-24T09:25:00-05:00'
.