Rounding
Trait Rounding.
Round, ceil, floor units.
Depends on the following methods:
Table of Contents
Methods
- ceil() : static
- Ceil the current instance second with given precision if specified.
- ceilUnit() : static
- Ceil the current instance at the given unit with given precision if specified.
- ceilWeek() : static
- Ceil the current instance week.
- copy() : void
- floor() : static
- Round the current instance second with given precision if specified.
- floorUnit() : static
- Truncate the current instance at the given unit with given precision if specified.
- floorWeek() : static
- Truncate the current instance week.
- round() : static
- Round the current instance second with given precision if specified.
- roundUnit() : static
- Round the current instance at the given unit with given precision if specified and the given function.
- roundWeek() : static
- Round the current instance week.
- startOfWeek() : void
Methods
ceil()
Ceil the current instance second with given precision if specified.
public
ceil([DateInterval|string|float|int $precision = 1 ]) : static
Parameters
- $precision : DateInterval|string|float|int = 1
Return values
staticceilUnit()
Ceil the current instance at the given unit with given precision if specified.
public
ceilUnit(string $unit[, DateInterval|string|float|int $precision = 1 ]) : static
Parameters
- $unit : string
- $precision : DateInterval|string|float|int = 1
Return values
staticceilWeek()
Ceil the current instance week.
public
ceilWeek([WeekDay|int|null $weekStartsAt = null ]) : static
Parameters
- $weekStartsAt : WeekDay|int|null = null
-
optional start allow you to specify the day of week to use to start the week
Return values
staticcopy()
public
static copy() : void
floor()
Round the current instance second with given precision if specified.
public
floor([DateInterval|string|float|int $precision = 1 ]) : static
Parameters
- $precision : DateInterval|string|float|int = 1
Return values
staticfloorUnit()
Truncate the current instance at the given unit with given precision if specified.
public
floorUnit(string $unit[, DateInterval|string|float|int $precision = 1 ]) : static
Parameters
- $unit : string
- $precision : DateInterval|string|float|int = 1
Return values
staticfloorWeek()
Truncate the current instance week.
public
floorWeek([WeekDay|int|null $weekStartsAt = null ]) : static
Parameters
- $weekStartsAt : WeekDay|int|null = null
-
optional start allow you to specify the day of week to use to start the week
Return values
staticround()
Round the current instance second with given precision if specified.
public
round([DateInterval|string|float|int $precision = 1 ][, callable|string $function = 'round' ]) : static
Parameters
- $precision : DateInterval|string|float|int = 1
- $function : callable|string = 'round'
Return values
staticroundUnit()
Round the current instance at the given unit with given precision if specified and the given function.
public
roundUnit(string $unit[, DateInterval|string|float|int $precision = 1 ][, callable|string $function = 'round' ]) : static
Parameters
- $unit : string
- $precision : DateInterval|string|float|int = 1
- $function : callable|string = 'round'
Return values
staticroundWeek()
Round the current instance week.
public
roundWeek([WeekDay|int|null $weekStartsAt = null ]) : static
Parameters
- $weekStartsAt : WeekDay|int|null = null
-
optional start allow you to specify the day of week to use to start the week
Return values
staticstartOfWeek()
public
static startOfWeek(int $weekStartsAt = null) : void
Parameters
- $weekStartsAt = null : int