DateInterval

Type
Class
Namespace
Craft
Inherits
Craft\DateInterval » DateInterval (opens new window)
Since
1.0

Class DateInterval

See also http://craftcms.com

View source (opens new window)

# Public Methods

Method Description
__toString() Returns the interval specification.
fromSeconds() Returns the DateInterval instance for the number of seconds.
humanDuration() Returns the interval in a human-friendly string.
toSeconds() Returns the total number of seconds in the interval.
toSpec() Returns the interval specification.

# __toString()

Returns the interval specification.

View source (opens new window)

Returns

string (opens new window) – The interval specification.

Signature

public string __toString ( )

# fromSeconds()

Returns the DateInterval instance for the number of seconds.

View source (opens new window)

Arguments

Returns

Craft\DateInterval – The date interval.

Signature

public static Craft\DateInterval fromSeconds ( $seconds )

# humanDuration()

Returns the interval in a human-friendly string.

View source (opens new window)

Arguments

Returns

string (opens new window)

Signature

public string humanDuration ( $showSeconds = true )

# toSeconds()

Returns the total number of seconds in the interval.

View source (opens new window)

Arguments

Returns

string (opens new window) – The number of seconds.

Signature

public string toSeconds ( DateInterval $interval = null )

# toSpec()

Returns the interval specification.

View source (opens new window)

Arguments

Returns

string (opens new window) – The interval specification.

Signature

public string toSpec ( DateInterval $interval = null )

# Constants

Constant Description
SECONDS_DAY Number of seconds in a day.
SECONDS_HOUR Number of seconds in an hour.
SECONDS_MINUTE Number of seconds in a minute.
SECONDS_MONTH The number of seconds in a month.
SECONDS_YEAR The number of seconds in a year.