DateInterval

Type
Class
Namespace
Craft
Inherits
Craft\DateInterval » DateInterval
Since
1.0

Class DateInterval

See also http://craftcms.com

View source

Public Methods

MethodDescription
__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

Returns

string – The interval specification.

Signature

public string __toString ( )

fromSeconds()

Returns the DateInterval instance for the number of seconds.

View source

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

Arguments

Returns

string

Signature

public string humanDuration ( $showSeconds = true )

toSeconds()

Returns the total number of seconds in the interval.

View source

Arguments

Returns

string – The number of seconds.

Signature

public string toSeconds ( DateInterval $interval = null )

toSpec()

Returns the interval specification.

View source

Arguments

Returns

string – The interval specification.

Signature

public string toSpec ( DateInterval $interval = null )

Constants

ConstantDescription
SECONDS_DAYNumber of seconds in a day.
SECONDS_HOURNumber of seconds in an hour.
SECONDS_MINUTENumber of seconds in a minute.
SECONDS_MONTHThe number of seconds in a month.
SECONDS_YEARThe number of seconds in a year.