Skip to content

Kirby 4.4.1

$date->nearest()

Returns the datetime which is nearest to the object's datetime

$date->nearest(DateTimeInterface|string|int ...$datetime = null): DateTimeInterface|string|int

Parameters

Name Type Default Description
... $datetime DateTimeInterface|string|int null Datetime strings, UNIX timestamps or objects

Return type

DateTimeInterface|string|int

Parent class

Kirby\Toolkit\Date