Skip to content

Kirby 3.6.6

$date->round()

Rounds the date to the nearest value of the given unit

$date->round(string $unit, int $size = 1): Kirby\Toolkit\Date

Parameters

Name Type Default Description
$unit * string year, month, day, hour, minute or second
$size int 1 Rounding step starting at 0 of the specified unit

Return type

Kirby\Toolkit\Date

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

Exceptions

Type Description
Kirby\Exception\InvalidArgumentException If the unit name or size is invalid

Parent class

Kirby\Toolkit\Date