Units
Trait Units.
Add, subtract and set units.
Table of Contents
- add() : static
- Add given units or interval to the current instance.
- addRealUnit() : static
- Add seconds to the instance using timestamp. Positive $value travels forward while negative $value travels into the past.
- addUnit() : static
- Add given units to the current instance.
- isModifiableUnit() : bool
- Returns true if a property can be changed via setter.
- sub() : static
- Subtract given units or interval to the current instance.
- subRealUnit() : mixed
- subtract() : static
- Subtract given units or interval to the current instance.
- subUnit() : static
- Subtract given units to the current instance.
Methods
add()
Add given units or interval to the current instance.
public
add(string|DateInterval $unit[, int $value = 1 ][, bool|null $overflow = null ]) : static
Parameters
- $unit : string|DateInterval
- $value : int = 1
- $overflow : bool|null = null
Tags
Return values
static —addRealUnit()
Add seconds to the instance using timestamp. Positive $value travels forward while negative $value travels into the past.
public
addRealUnit(string $unit[, int $value = 1 ]) : static
Parameters
- $unit : string
- $value : int = 1
Return values
static —addUnit()
Add given units to the current instance.
public
addUnit(string $unit[, int $value = 1 ][, bool|null $overflow = null ]) : static
Parameters
- $unit : string
- $value : int = 1
- $overflow : bool|null = null
Return values
static —isModifiableUnit()
Returns true if a property can be changed via setter.
public
static isModifiableUnit(string $unit) : bool
Parameters
- $unit : string
Return values
bool —sub()
Subtract given units or interval to the current instance.
public
sub(string|DateInterval $unit[, int $value = 1 ][, bool|null $overflow = null ]) : static
Parameters
- $unit : string|DateInterval
- $value : int = 1
- $overflow : bool|null = null
Tags
Return values
static —subRealUnit()
public
subRealUnit(mixed $unit[, mixed $value = 1 ]) : mixed
Parameters
- $unit : mixed
- $value : mixed = 1
Return values
mixed —subtract()
Subtract given units or interval to the current instance.
public
subtract(string|DateInterval $unit[, int $value = 1 ][, bool|null $overflow = null ]) : static
Parameters
- $unit : string|DateInterval
- $value : int = 1
- $overflow : bool|null = null
Tags
Return values
static —subUnit()
Subtract given units to the current instance.
public
subUnit(string $unit[, int $value = 1 ][, bool|null $overflow = null ]) : static
Parameters
- $unit : string
- $value : int = 1
- $overflow : bool|null = null