$date->round()
Rounds the date to the nearest value of the given unit
$date->round('year'|'month'|'day'|'hour'|'minute'|'second' $unit, int $size = 1): Date
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| $unitrequired | 'year'or'month'or'day'or'hour'or'minute'or'second' |
no default value | |
| $size | int |
1
|
Rounding step starting at 0 of the specified unit |
Return type
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 |