Documentation

ReadableDuration
in package

Table of Contents

Constants

DAYS_PER_MONTH  = 30.44
DAYS_PER_YEAR  = 365.25
HOURS_PER_DAY  = 24
INTERVAL_DAY_KEY  = 'd'
INTERVAL_HOUR_KEY  = 'h'
INTERVAL_MINUTE_KEY  = 'i'
INTERVAL_MONTH_KEY  = 'm'
INTERVAL_SECOND_KEY  = 's'
INTERVAL_YEAR_KEY  = 'y'
MAX_APPROPRIATE_UNITS_PRECISION  = 6
MINUTES_PER_HOUR  = 60
MONTHS_PER_YEAR  = 12
SECONDS_PER_MINUTE  = 60
UNIT_DAY  = 'day'
UNIT_HOUR  = 'hour'
UNIT_MINUTE  = 'minute'
UNIT_MONTH  = 'month'
UNIT_SECOND  = 'second'
UNIT_YEAR  = 'year'

Properties

$comparatorTime  : DateTime
$currentTime  : DateTime
$interval  : DateInterval
$unitsToIntervalUnits  : mixed
$unitThresholds  : mixed
$valueInSeconds  : int

Methods

__construct()  : mixed
getDays()  : int
getHours()  : int
getInDays()  : float
getInHours()  : float
getInMinutes()  : float
getInMonths()  : float
getInMostAppropriateUnits()  : mixed
getInSeconds()  : int
getInYears()  : float
getMinutes()  : int
getMonths()  : int
getRoundedDays()  : int
getRoundedHours()  : int
getRoundedMinutes()  : int
getRoundedMonths()  : int
getRoundedYears()  : int
getSeconds()  : int
getYears()  : int
isFuture()  : bool
isPast()  : bool
isPresent()  : bool
setValueInSeconds()  : ReadableDuration
getInterval()  : DateInterval
getLargestIntervalUnit()  : mixed
getSecondsPerDay()  : int
getSecondsPerHour()  : int
getSecondsPerMonth()  : int
getSecondsPerYear()  : int
roundUpUnitValues()  : mixed

Constants

MAX_APPROPRIATE_UNITS_PRECISION

public mixed MAX_APPROPRIATE_UNITS_PRECISION = 6

Properties

$unitsToIntervalUnits

private mixed $unitsToIntervalUnits = array(self::UNIT_YEAR => self::INTERVAL_YEAR_KEY, self::UNIT_MONTH => self::INTERVAL_MONTH_KEY, self::UNIT_DAY => self::INTERVAL_DAY_KEY, self::UNIT_HOUR => self::INTERVAL_HOUR_KEY, self::UNIT_MINUTE => self::INTERVAL_MINUTE_KEY, self::UNIT_SECOND => self::INTERVAL_SECOND_KEY)

$unitThresholds

private mixed $unitThresholds = array(self::UNIT_MONTH => self::MONTHS_PER_YEAR, self::UNIT_DAY => self::DAYS_PER_MONTH, self::UNIT_HOUR => self::HOURS_PER_DAY, self::UNIT_MINUTE => self::MINUTES_PER_HOUR, self::UNIT_SECOND => self::SECONDS_PER_MINUTE)

Methods

__construct()

public __construct([type $valueInSeconds = null ]) : mixed
Parameters
$valueInSeconds : type = null

getInMostAppropriateUnits()

public getInMostAppropriateUnits([mixed $precision = 1 ]) : mixed
Parameters
$precision : mixed = 1

getInterval()

private getInterval() : DateInterval
Return values
DateInterval

getSecondsPerHour()

private getSecondsPerHour() : int
Return values
int

getSecondsPerMonth()

private getSecondsPerMonth() : int
Return values
int

getSecondsPerYear()

private getSecondsPerYear() : int
Return values
int

roundUpUnitValues()

private roundUpUnitValues(mixed $unitValues) : mixed
Parameters
$unitValues : mixed

        
On this page

Search results