Horde_Date_Utils
Horde Date wrapper/logic class, including some calculation functions.
Tags
Table of Contents
- daysInMonth() : int
- Returns the number of days in the specified month.
- firstDayOfWeek() : Horde_Date
- Returns the date of the year that corresponds to the first day of the given week.
- isLeapYear() : bool
- Returns whether a year is a leap year.
- relativeDateTime() : string
- Returns a relative, natural language representation of a timestamp
- strftime2date() : string
- Tries to convert strftime() formatters to date() formatters.
Methods
daysInMonth()
Returns the number of days in the specified month.
public
static daysInMonth(int $month, int $year) : int
Parameters
- $month : int
-
The month
- $year : int
-
The year.
Return values
int —The number of days in the month.
firstDayOfWeek()
Returns the date of the year that corresponds to the first day of the given week.
public
static firstDayOfWeek(int $week, int $year) : Horde_Date
Parameters
- $week : int
-
The week of the year to find the first day of.
- $year : int
-
The year to calculate for.
Return values
Horde_Date —The date of the first day of the given week.
isLeapYear()
Returns whether a year is a leap year.
public
static isLeapYear(int $year) : bool
Parameters
- $year : int
-
The year.
Return values
bool —True if the year is a leap year.
relativeDateTime()
Returns a relative, natural language representation of a timestamp
public
static relativeDateTime(mixed $time[, string $date_format = '%x' ][, string $time_format = '%X' ]) : string
Parameters
- $time : mixed
-
The time. Any format accepted by Horde_Date.
- $date_format : string = '%x'
-
Format to display date if timestamp is more then 1 day old.
- $time_format : string = '%X'
-
Format to display time if timestamp is 1 day old.
Tags
Return values
string —The relative time (i.e. 2 minutes ago)
strftime2date()
Tries to convert strftime() formatters to date() formatters.
public
static strftime2date(string $format) : string
Unsupported formatters will be removed.
Parameters
- $format : string
-
A strftime() formatting string.
Return values
string —A date() formatting string.