Skip to content

Kirby 5.0.4

$date->nearest()

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

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

Parameters

Name Type Default Description
...$datetime stringorintorDateTimeInterface no default value Datetime strings, UNIX timestamps or objects

Return types

DateTimeInterfaceorstringorint

This method modifies the existing $date object it is applied to and returns it again.

Parent class

Kirby\Toolkit\Date