\Horde_Date_Utils

Horde Date wrapper/logic class, including some calculation functions.

Summary

Methods
Properties
Constants
isLeapYear()
firstDayOfWeek()
daysInMonth()
relativeDateTime()
strftime2date()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

isLeapYear()

isLeapYear(integer  $year) : boolean

Returns whether a year is a leap year.

Parameters

integer $year

The year.

Returns

boolean —

True if the year is a leap year.

firstDayOfWeek()

firstDayOfWeek(integer  $week, integer  $year) : \Horde_Date

Returns the date of the year that corresponds to the first day of the given week.

Parameters

integer $week

The week of the year to find the first day of.

integer $year

The year to calculate for.

Returns

\Horde_Date

The date of the first day of the given week.

daysInMonth()

daysInMonth(integer  $month, integer  $year) : integer

Returns the number of days in the specified month.

Parameters

integer $month

The month

integer $year

The year.

Returns

integer —

The number of days in the month.

relativeDateTime()

relativeDateTime(mixed  $time, string  $date_format = '%x', string  $time_format = '%X') : string

Returns a relative, natural language representation of a timestamp

Parameters

mixed $time

The time. Any format accepted by Horde_Date.

string $date_format

Format to display date if timestamp is more then 1 day old.

string $time_format

Format to display time if timestamp is 1 day old.

Returns

string —

The relative time (i.e. 2 minutes ago)

strftime2date()

strftime2date(string  $format) : string

Tries to convert strftime() formatters to date() formatters.

Unsupported formatters will be removed.

Parameters

string $format

A strftime() formatting string.

Returns

string —

A date() formatting string.