Skip to content

Kirby 3.6.6

$date->nearest()

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

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

Parameters

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

Return type

string|int|DateTimeInterface

Parent class

Kirby\Toolkit\Date