Skip to content

Points in time

See the clocks to learn to have access to these objects.

All examples below use the $point variable that reference an instance of Innmind\TimeContinuum\PointInTime.

Year

$point->year()->toInt();

This will return the year as an int.

$point->year()->numberOfDays();

This returns 365 or 366 on leap years.

Month

$point->month()->ofYear();

This returns a value from the enum Innmind\TimeContinuum\Calendar\Month.

$point->month()->numberOfDays();

This returns an int between 28 and 31.

Day

$point->day()->ofYear();

This returns an int between 0 and 365.

$point->day()->ofMonth();

This returns an int between 1 and 31.

$point->day()->ofWeek();

This returns a value from the enum Innmind\TimeContinuum\Calendar\Day.

Hour

$point->hour()->toInt();

This returns an int between 0 and 23.

Minute

$point->minute()->toInt();

This returns an int between 0 and 59.

Second

$point->second()->toInt();

This returns an int between 0 and 59.

Millisecond

$point->millisecond()->toInt();

This returns an int between 0 and 999.

Microsecond

$point->microsecond()->toInt();

This returns an int between 0 and 999.

Offset

$offset = $point->offset();
$hours = $offset->hours();
$minutes = $offset->minutes();

$hours is an int between -12 and 14. $minutes is an int between 0 and 59 but usually is either 0, 15, 30 or 45.

Comparing points

$point->aheadOf($anotherPoint);
$point->equals($anotherPoint);

Both methods return a bool.