Class TimeUnit
Time units and conversion.
Methods summary
public static
assertValidUnit( mixed $unit
)
Asserts the given unit is valid.
Asserts the given unit is valid.
Parameters
public static
getUnits( void )
: integer[]
Returns a list of predefined units.
Returns a list of predefined units.
Returns
integer[]
public static
getUnitLabels( integer|null $unit
= null )
: string|null|string[]
Returns the labels of a given unit, or of all units.
Returns the labels of a given unit, or of all units.
Parameters
Returns
string|null|string[]
public static
getLabelsToUnits( void )
: integer[]
Returns an mapping of labels to associated unit.
Returns an mapping of labels to associated unit.
Returns
integer[]
public static
labelToUnit( string $label
)
: integer|null
Returns the unit associated to the given label.
Returns the unit associated to the given label.
Parameters
Returns
integer|null
public static
convert( integer|float $value
, integer $fromUnit
, integer $toUnit
)
: integer|float
Converts a value from a given unit to another.
Converts a value from a given unit to another.
Parameters
Returns
integer|float
Constants summary
MICROSECONDS
: integer
-6
MILLISECONDS
: integer
-3