category Zend
package Zend_Date
copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
license New BSD License
inherited_from \Zend_Date_DateObject

 Methods

Generates the standard date object, could be a unix timestamp, localized date, string, integer, array and so on. Also parts of dates or time are supported Always set the default timezone: http://php.net/date_default_timezone_set For example, in your bootstrap: date_default_timezone_set('America/Los_Angeles'); For detailed instructions please look in the docu.

__construct(string|integer|\Zend_Date|array $date = null, string $part = null, string|\Zend_Locale $locale = null) : \Zend_Date

Parameters

$date

stringinteger\Zend_Datearray

OPTIONAL Date value or value of date part to set ,depending on $part. If null the actual time is set

$part

string

OPTIONAL Defines the input format of $date

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

\Zend_Date

Returns a string representation of the date which is equal with the timestamp

__toString() : string

Returns

string

Adds a date or datepart to the existing date, by extracting $part from $date, and modifying this object by adding that part. The $part is then extracted from this object and returned as an integer or numeric string (for large values, or $part's corresponding to pre-defined formatted date strings).

add(string|integer|array|\Zend_Date $date, string $part = self::TIMESTAMP, string|\Zend_Locale $locale = null) : \Zend_Date

This could be for example a ISO 8601 date, the hour the monthname or only the minute. There are about 50 different supported date parts. For a complete list of supported datepart values look into the docu.

Parameters

$date

stringintegerarray\Zend_Date

Date or datepart to add

$part

string

OPTIONAL Part of the date to add, if null the timestamp is added

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

\Zend_DateProvides a fluent interface

Adds a RFC 822 date to the date object.

addArpa(string|integer|\Zend_Date $date, string|\Zend_Locale $locale = null) : \Zend_Date

ARPA messages are used in emails or HTTP Headers. Only RFC 822 compilant date strings are accepted. For example: Sat, 14 Feb 09 00:31:30 +0100 Returned is the new date object

Parameters

$date

stringinteger\Zend_Date

RFC 822 Date to add

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

\Zend_DateProvides a fluent interface

Adds a date to the existing date object. Format defines how to parse the date string.

addDate(string|integer|array|\Zend_Date $date, string $format = null, string|\Zend_Locale $locale = null) : \Zend_Date

If only parts are given the other parts are set to 0. If no format is given, the standardformat of this locale is used. For example: MM.dd.YYYY -> 10 -> +10 months

Parameters

$date

stringintegerarray\Zend_Date

Date to add

$format

string

OPTIONAL Date format for parsing input

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

\Zend_DateProvides a fluent interface

Adds days to the existing date object.

addDay(string|integer|array|\Zend_Date $day, string|\Zend_Locale $locale = null) : \Zend_Date

The day can be a number or a string. Adding days lower then 0 or greater than the number of this months days will result in adding or subtracting the relevant month. If a localized dayname is given it will be parsed with the default locale or the optional set locale.

Parameters

$day

stringintegerarray\Zend_Date

Day to add

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

\Zend_DateProvides a fluent interface

Adds a day of year to the existing date object.

addDayOfYear(string|integer|array|\Zend_Date $day, string|\Zend_Locale $locale = null) : \Zend_Date

The day of year is always a number. Returned is the new date object Example: addDayOfYear(10); will add 10 days to the existing date object.

Parameters

$day

stringintegerarray\Zend_Date

Day of Year to add

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

\Zend_DateProvides a fluent interface

Adds hours to the existing date object.

addHour(string|integer|array|\Zend_Date $hour, string|\Zend_Locale $locale = null) : \Zend_Date

The hour is always a number. Returned is the new date object Example: 04.May.1993 13:07:25 -> addHour(12); -> 05.May.1993 01:07:25

Parameters

$hour

stringintegerarray\Zend_Date

Hour to add

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

\Zend_DateProvides a fluent interface

Adds a ISO date to the date object. Not given parts are set to default.

addIso(string|integer|\Zend_Date $date, string|\Zend_Locale $locale = null) : \Zend_Date

Only supported ISO 8601 formats are accepted. For example: 050901 -> + 01.Sept.2005 00:00:00, 10:00:00 -> +10h Returned is the new date object

Parameters

$date

stringinteger\Zend_Date

ISO Date to add

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

\Zend_DateProvides a fluent interface

Adds milliseconds to the date object

addMilliSecond(integer|\Zend_Date $milli = null, integer $precision = null) : \Zend_Date

Parameters

$milli

integer\Zend_Date

(Optional) Millisecond to add, when null the actual millisecond is added

$precision

integer

(Optional) Fractional precision for the given milliseconds

Exceptions

\Zend_Date_Exception

Returns

\Zend_DateProvides a fluent interface

Adds minutes to the existing date object.

addMinute(string|integer|array|\Zend_Date $minute, string|\Zend_Locale $locale = null) : \Zend_Date

The minute is always a number. Returned is the new date object Example: 04.May.1993 13:07:25 -> addMinute(65); -> 04.May.1993 13:12:25

Parameters

$minute

stringintegerarray\Zend_Date

Minute to add

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

\Zend_DateProvides a fluent interface

Adds months to the existing date object.

addMonth(string|integer|array|\Zend_Date $month, string|\Zend_Locale $locale = null) : \Zend_Date

The month can be a number or a string. Adding months lower then 0 and greater then 12 will result in adding or subtracting the relevant year. (12 months equal one year) If a localized monthname is given it will be parsed with the default locale or the optional set locale. Returned is the new date object

Parameters

$month

stringintegerarray\Zend_Date

Month to add

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

\Zend_DateProvides a fluent interface

Adds seconds to the existing date object.

addSecond(string|integer|array|\Zend_Date $second, string|\Zend_Locale $locale = null) : \Zend_Date

The second is always a number. Returned is the new date object Example: 04.May.1993 13:07:25 -> addSecond(65); -> 04.May.1993 13:08:30

Parameters

$second

stringintegerarray\Zend_Date

Second to add

$locale

string\Zend_Locale

(Optional) Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

\Zend_DateProvides a fluent interface

Adds a time to the existing date. Format defines how to parse the time string.

addTime(string|integer|array|\Zend_Date $time, string $format = null, string|\Zend_Locale $locale = null) : \Zend_Date

If only parts are given the other parts are set to 0. If no format is given, the standardformat of this locale is used. For example: HH:mm:ss -> 10 -> +10 hours

Parameters

$time

stringintegerarray\Zend_Date

Time to add

$format

string

OPTIONAL Timeformat for parsing input

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

\Zend_DateProvides a fluent interface

Adds a timestamp

addTimestamp(integer|string|array|\Zend_Date $timestamp) : \Zend_Date

Parameters

$timestamp

integerstringarray\Zend_Date

Timestamp to add

Exceptions

\Zend_Date_Exception

Returns

\Zend_DateProvides a fluent interface

Adds a week. The week is always a number. The day of week is not changed.

addWeek(string|integer|array|\Zend_Date $week, string|\Zend_Locale $locale = null) : \Zend_Date

Returned is the new date object Example: 09.Jan.2007 13:07:25 -> addWeek(1); -> 16.Jan.2007 13:07:25

Parameters

$week

stringintegerarray\Zend_Date

Week to add

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

\Zend_DateProvides a fluent interface

Adds weekdays to the existing date object.

addWeekday(string|integer|array|\Zend_Date $weekday, string|\Zend_Locale $locale = null) : \Zend_Date

The weekday can be a number or a string. If a localized dayname is given it will be parsed with the default locale or the optional set locale. Returned is the new date object Example: addWeekday(3); will add the difference of days from the begining of the month until wednesday.

Parameters

$weekday

stringintegerarray\Zend_Date

Weekday to add

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

\Zend_DateProvides a fluent interface

Adds the year to the existing date object If the year is between 0 and 69, 2000 will be added (2000-2069) If the year if between 70 and 99, 1999 will be added (1970-1999) 3 or 4 digit years are added as expected. If you need to add years from 0-99 use add() instead.

addYear(string|integer|array|\Zend_Date $year, string|\Zend_Locale $locale = null) : \Zend_Date

Returned is the new date object

Parameters

$year

stringintegerarray\Zend_Date

Year to add

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

\Zend_DateProvides a fluent interface

Check a given year for leap year.

checkLeapYear(integer|array|\Zend_Date $year) : boolean
Static

Parameters

$year

integerarray\Zend_Date

Year to check

Exceptions

\Zend_Date_Exception

Returns

boolean

Compares a date or datepart with the existing one.

compare(string|integer|array|\Zend_Date $date, string $part = self::TIMESTAMP, string|\Zend_Locale $locale = null) : integer

Returns -1 if earlier, 0 if equal and 1 if later.

Parameters

$date

stringintegerarray\Zend_Date

Date or datepart to compare with the date object

$part

string

OPTIONAL Part of the date to compare, if null the timestamp is subtracted

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

integer0 = equal, 1 = later, -1 = earlier

Compares a RFC 822 compilant date with the date object.

compareArpa(string|integer|\Zend_Date $date, string|\Zend_Locale $locale = null) : integer

ARPA messages are used in emails or HTTP Headers. Only RFC 822 compilant date strings are accepted. For example: Sat, 14 Feb 09 00:31:30 +0100 Returns if equal, earlier or later

Parameters

$date

stringinteger\Zend_Date

RFC 822 Date to sub

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

integer0 = equal, 1 = later, -1 = earlier

Compares the date from the existing date object, ignoring the time.

compareDate(string|integer|array|\Zend_Date $date, string $format = null, string|\Zend_Locale $locale = null) : integer

Format defines how to parse the date string. If only parts are given the other parts are set to 0. If no format is given, the standardformat of this locale is used. For example: 10.01.2000 => 10.02.1999 -> false

Parameters

$date

stringintegerarray\Zend_Date

Date to compare

$format

string

OPTIONAL Date format for parsing input

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

integer0 = equal, 1 = later, -1 = earlier

Compares the day with the existing date object, ignoring other date parts.

compareDay(string|integer|array|\Zend_Date $day, string|\Zend_Locale $locale = null) : integer

For example: 'Monday', 'en' -> 08.Jan.2007 -> 0 Returns if equal, earlier or later

Parameters

$day

stringintegerarray\Zend_Date

Day to compare

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

integer0 = equal, 1 = later, -1 = earlier

Compares the day of year with the existing date object.

compareDayOfYear(string|integer|array|\Zend_Date $day, string|\Zend_Locale $locale = null) : integer

For example: compareDayOfYear(33) -> 02.Feb.2007 -> 0 Returns if equal, earlier or later

Parameters

$day

stringintegerarray\Zend_Date

Day of Year to compare

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

integer0 = equal, 1 = later, -1 = earlier

Compares the hour with the existing date object.

compareHour(string|integer|array|\Zend_Date $hour, string|\Zend_Locale $locale = null) : integer

For example: 10:30:25 -> compareHour(10) -> 0 Returns if equal, earlier or later

Parameters

$hour

stringintegerarray\Zend_Date

Hour to compare

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

integer0 = equal, 1 = later, -1 = earlier

Compares a ISO date with the date object. Not given parts are set to default.

compareIso(string|integer|\Zend_Date $date, string|\Zend_Locale $locale = null) : integer

Only supported ISO 8601 formats are accepted. For example: 050901 -> - 01.Sept.2005 00:00:00, 10:00:00 -> -10h Returns if equal, earlier or later

Parameters

$date

stringinteger\Zend_Date

ISO Date to sub

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

integer0 = equal, 1 = later, -1 = earlier

Compares only the millisecond part, returning the difference

compareMilliSecond(integer|\Zend_Date $milli = null, integer $precision = null) : integer

Parameters

$milli

integer\Zend_Date

OPTIONAL Millisecond to compare, when null the actual millisecond is compared

$precision

integer

OPTIONAL Fractional precision for the given milliseconds

Exceptions

\Zend_Date_Exception On invalid input

Returns

integer0 = equal, 1 = later, -1 = earlier

Compares the minute with the existing date object.

compareMinute(string|integer|array|\Zend_Date $minute, string|\Zend_Locale $locale = null) : integer

For example: 10:30:25 -> compareMinute(30) -> 0 Returns if equal, earlier or later

Parameters

$minute

stringintegerarray\Zend_Date

Hour to compare

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

integer0 = equal, 1 = later, -1 = earlier

Compares the month with the existing date object, ignoring other date parts.

compareMonth(string|integer|array|\Zend_Date $month, string|\Zend_Locale $locale = null) : integer

For example: 10.03.2000 -> 15.03.1950 -> true Returns if equal, earlier or later

Parameters

$month

stringintegerarray\Zend_Date

Month to compare

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

integer0 = equal, 1 = later, -1 = earlier

Compares the second with the existing date object.

compareSecond(string|integer|array|\Zend_Date $second, string|\Zend_Locale $locale = null) : integer

For example: 10:30:25 -> compareSecond(25) -> 0 Returns if equal, earlier or later

Parameters

$second

stringintegerarray\Zend_Date

Second to compare

$locale

string\Zend_Locale

(Optional) Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

integer0 = equal, 1 = later, -1 = earlier

Compares the time from the existing date. Format defines how to parse the time string.

compareTime(string|integer|array|\Zend_Date $time, string $format = null, string|\Zend_Locale $locale = null) : integer

If only parts are given the other parts are set to default. If no format us given, the standardformat of this locale is used. For example: HH:mm:ss -> 10 -> 10 hours

Parameters

$time

stringintegerarray\Zend_Date

Time to compare

$format

string

OPTIONAL Timeformat for parsing input

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

integer0 = equal, 1 = later, -1 = earlier

Compares two timestamps, returning the difference as integer

compareTimestamp(integer|string|array|\Zend_Date $timestamp) : integer

Parameters

$timestamp

integerstringarray\Zend_Date

Timestamp to compare

Exceptions

\Zend_Date_Exception

Returns

integer0 = equal, 1 = later, -1 = earlier

Compares only the week part, returning the difference Returned is the new date object Returns if equal, earlier or later Example: 09.Jan.2007 13:07:25 -> compareWeek(2); -> 0

compareWeek(string|integer|array|\Zend_Date $week, string|\Zend_Locale $locale = null) : integer

Parameters

$week

stringintegerarray\Zend_Date

Week to compare

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Returns

integer0 = equal, 1 = later, -1 = earlier

Compares the weekday with the existing date object, ignoring other date parts.

compareWeekday(string|integer|array|\Zend_Date $weekday, string|\Zend_Locale $locale = null) : integer

For example: 'Monday', 'en' -> 08.Jan.2007 -> 0 Returns if equal, earlier or later

Parameters

$weekday

stringintegerarray\Zend_Date

Weekday to compare

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

integer0 = equal, 1 = later, -1 = earlier

Compares the year with the existing date object, ignoring other date parts.

compareYear(string|integer|array|\Zend_Date $year, string|\Zend_Locale $locale = null) : integer

For example: 10.03.2000 -> 15.02.2000 -> true Returns if equal, earlier or later

Parameters

$year

stringintegerarray\Zend_Date

Year to compare

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

integer0 = equal, 1 = later, -1 = earlier

Returns a new instance of Zend_Date with the selected part copied.

copyPart(string $part, string|\Zend_Locale $locale = null) : \Zend_Date

To make an exact copy, use PHP's clone keyword. For a complete list of supported date part values look into the docu. If a date part is copied, all other date parts are set to standard values. For example: If only YEAR is copied, the returned date object is equal to 01-01-YEAR 00:00:00 (01-01-1970 00:00:00 is equal to timestamp 0) If only HOUR is copied, the returned date object is equal to 01-01-1970 HOUR:00:00 (so $this contains a timestamp equal to a timestamp of 0 plus HOUR).

Parameters

$part

string

Part of the date to compare, if null the timestamp is subtracted

$locale

string\Zend_Locale

OPTIONAL New object's locale. No adjustments to timezone are made.

Returns

\Zend_DateNew clone with requested part

Returns true when both date objects or date parts are equal.

equals(string|integer|array|\Zend_Date $date, string $part = self::TIMESTAMP, string|\Zend_Locale $locale = null) : boolean

For example: 15.May.2000 <-> 15.June.2000 Equals only for Day or Year... all other will return false

Parameters

$date

stringintegerarray\Zend_Date

Date or datepart to equal with

$part

string

OPTIONAL Part of the date to compare, if null the timestamp is used

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

boolean

Returns a representation of a date or datepart This could be for example a localized monthname, the time without date, the era or only the fractional seconds. There are about 50 different supported date parts.

get(string $part = null, string|\Zend_Locale $locale = null) : string

For a complete list of supported datepart values look into the docu

Parameters

$part

string

OPTIONAL Part of the date to return, if null the timestamp is returned

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Returns

stringdate or datepart

Returns a RFC 822 compilant datestring from the date object.

getArpa(string|\Zend_Locale $locale = null) : string

This function does not return the RFC date as object. Use copy() instead.

Parameters

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Returns

string

Returns a clone of $this, with the time part set to 00:00:00.

getDate(string|\Zend_Locale $locale = null) : \Zend_Date

Parameters

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Returns

\Zend_Date

Returns the day as new date object Example: 20.May.1986 -> 20.Jan.1970 00:00:00

getDay(\Zend_Locale $locale = null) : \Zend_Date

Parameters

$locale

\Zend_Locale

OPTIONAL Locale for parsing input

Returns

\Zend_Date

Returns the day of year as new date object Example: 02.Feb.1986 10:00:00 -> 02.Feb.1970 00:00:00

getDayOfYear(string|\Zend_Locale $locale = null) : \Zend_Date

Parameters

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Returns

\Zend_Date

Returns the precision for fractional seconds

getFractionalPrecision() : integer

Returns

integer

Counts the exact year number < 70 - 2000 added, >70 < 100 - 1900, others just returned

getFullYear(integer $value) : integer
Static

Parameters

$value

integer

year number

Returns

integerNumber of year

Return the offset to GMT of $this object's timezone.

getGmtOffset() : integer
Inherited

The offset to GMT is initially set when the object is instantiated using the currently, in effect, default timezone for PHP functions.

Returns

integerseconds difference between GMT timezone and timezone when object was instantiated

Returns the hour as new date object Example: 02.Feb.1986 10:30:25 -> 01.Jan.1970 10:00:00

getHour(\Zend_Locale $locale = null) : \Zend_Date

Parameters

$locale

\Zend_Locale

OPTIONAL Locale for parsing input

Returns

\Zend_Date

Returns the full ISO 8601 date from the date object.

getIso(string|\Zend_Locale $locale = null) : string

Always the complete ISO 8601 specifiction is used. If an other ISO date is needed (ISO 8601 defines several formats) use toString() instead. This function does not return the ISO date as object. Use copy() instead.

Parameters

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Returns

string

Returns the actual set locale

getLocale() : string

Returns

string

Returns the milliseconds of the date object

getMilliSecond() : string

Returns

string

Returns the minute as new date object Example: 02.Feb.1986 10:30:25 -> 01.Jan.1970 00:30:00

getMinute(string|\Zend_Locale $locale = null) : \Zend_Date

Parameters

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Returns

\Zend_Date

Returns only the month from the date object as new object.

getMonth(string|\Zend_Locale $locale = null) : \Zend_Date

For example: 10.May.2000 10:30:00 -> 01.May.1970 00:00:00

Parameters

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Returns

\Zend_Date

Returns the second as new date object Example: 02.Feb.1986 10:30:25 -> 01.Jan.1970 00:00:25

getSecond(string|\Zend_Locale $locale = null) : \Zend_Date

Parameters

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Returns

\Zend_Date

Returns an array with the sunset and sunrise dates for all horizon types For a list of cities and correct locations use the class Zend_Date_Cities

getSunInfo(array $location) : array

Parameters

$location

array

location of suninfo ['horizon'] -> civil, nautic, astronomical, effective (default) ['longitude'] -> longitude of location ['latitude'] -> latitude of location

Exceptions

\Zend_Date_Exception

Returns

array- [sunset|sunrise][effective|civil|nautic|astronomic]

Returns the time of sunrise for this date and a given location as new date object For a list of cities and correct locations use the class Zend_Date_Cities

getSunrise(array $location) : \Zend_Date

Parameters

$location

array

location of sunrise ['horizon'] -> civil, nautic, astronomical, effective (default) ['longitude'] -> longitude of location ['latitude'] -> latitude of location

Exceptions

\Zend_Date_Exception

Returns

\Zend_Date

Returns the time of sunset for this date and a given location as new date object For a list of cities and correct locations use the class Zend_Date_Cities

getSunset(array $location) : \Zend_Date

Parameters

$location

array

location of sunset ['horizon'] -> civil, nautic, astronomical, effective (default) ['longitude'] -> longitude of location ['latitude'] -> latitude of location

Exceptions

\Zend_Date_Exception

Returns

\Zend_Date

Returns only the time of the date as new Zend_Date object For example: 15.May.2000 10:11:23 will return a dateobject equal to 01.Jan.1970 10:11:23

getTime(string|\Zend_Locale $locale = null) : \Zend_Date

Parameters

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Returns

\Zend_Date

Returns this object's internal UNIX timestamp (equivalent to Zend_Date::TIMESTAMP).

getTimestamp() : integer | string

If the timestamp is too large for integers, then the return value will be a string. This function does not return the timestamp as an object. Use clone() or copyPart() instead.

Returns

integerstringUNIX timestamp

Return the timezone of $this object.

getTimezone() : string
Inherited

The timezone is initially set when the object is instantiated.

Returns

stringactual set timezone string

Internal function, returns the offset of a given timezone

getTimezoneFromString(string $zone) : integer

Parameters

$zone

string

Returns

integer

Returns the week as new date object using monday as begining of the week Example: 12.Jan.2007 -> 08.Jan.1970 00:00:00

getWeek(\Zend_Locale $locale = null) : \Zend_Date

Parameters

$locale

\Zend_Locale

OPTIONAL Locale for parsing input

Returns

\Zend_Date

Returns the weekday as new date object Weekday is always from 1-7 Example: 09-Jan-2007 -> 2 = Tuesday -> 02-Jan-1970 (when 02.01.1970 is also Tuesday)

getWeekday(\Zend_Locale $locale = null) : \Zend_Date

Parameters

$locale

\Zend_Locale

OPTIONAL Locale for parsing input

Returns

\Zend_Date

Returns only the year from the date object as new object.

getYear(string|\Zend_Locale $locale = null) : \Zend_Date

For example: 10.May.2000 10:30:00 -> 01.Jan.2000 00:00:00

Parameters

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Returns

\Zend_Date

Checks if the given date is a real date or datepart.

isDate(string|array|\Zend_Date $date, string $format = null, string|\Zend_Locale $locale = null) : boolean
Static

Returns false if a expected datepart is missing or a datepart exceeds its possible border. But the check will only be done for the expected dateparts which are given by format. If no format is given the standard dateformat for the actual locale is used. f.e. 30.February.2007 will return false if format is 'dd.MMMM.YYYY'

Parameters

$date

stringarray\Zend_Date

Date to parse for correctness

$format

string

(Optional) Format for parsing the date string

$locale

string\Zend_Locale

(Optional) Locale for parsing date parts

Returns

booleanTrue when all date parts are correct

Returns if the given date or datepart is earlier For example: 15.May.2000 <-> 13.June.1999 will return true for day, year and date, but not for month

isEarlier(string|integer|array|\Zend_Date $date, string $part = null, string|\Zend_Locale $locale = null) : boolean

Parameters

$date

stringintegerarray\Zend_Date

Date or datepart to compare with

$part

string

OPTIONAL Part of the date to compare, if null the timestamp is used

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

boolean

Returns if the given date or datepart is later For example: 15.May.2000 <-> 13.June.1999 will return true for month but false for day, year and date Returns if the given date is later

isLater(string|integer|array|\Zend_Date $date, string $part = null, string|\Zend_Locale $locale = null) : boolean

Parameters

$date

stringintegerarray\Zend_Date

Date or datepart to compare with

$part

string

OPTIONAL Part of the date to compare, if null the timestamp is used

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

boolean

Returns true, if the year is a leap year.

isLeapYear() : boolean

Returns

boolean

Returns if the set date is todays date

isToday() : boolean

Returns

boolean

Returns if the set date is tomorrows date

isTomorrow() : boolean

Returns

boolean

Returns if the set date is yesterdays date

isYesterday() : boolean

Returns

boolean

Returns the actual date as new date object

now(string|\Zend_Locale $locale = null) : \Zend_Date
Static

Parameters

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Returns

\Zend_Date

Sets the given date as new date or a given datepart as new datepart returning the new datepart This could be for example a localized dayname, the date without time, the month or only the seconds. There are about 50 different supported date parts.

set(string|integer|array|\Zend_Date $date, string $part = null, string|\Zend_Locale $locale = null) : \Zend_Date

For a complete list of supported datepart values look into the docu

Parameters

$date

stringintegerarray\Zend_Date

Date or datepart to set

$part

string

OPTIONAL Part of the date to set, if null the timestamp is set

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

\Zend_DateProvides a fluent interface

Sets a RFC 822 date as new date for the date object.

setArpa(string|integer|\Zend_Date $date, string|\Zend_Locale $locale = null) : \Zend_Date

Only RFC 822 compilant date strings are accepted. For example: Sat, 14 Feb 09 00:31:30 +0100 Returned is the new date object

Parameters

$date

stringinteger\Zend_Date

RFC 822 to set

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

\Zend_DateProvides a fluent interface

Sets a new date for the date object. Format defines how to parse the date string.

setDate(string|integer|array|\Zend_Date $date, string $format = null, string|\Zend_Locale $locale = null) : \Zend_Date

Also a complete date with time can be given, but only the date is used for setting. For example: MMMM.yy HH:mm-> May.07 22:11 => 01.May.07 00:00 Returned is the new date object and the existing time is left as it was before

Parameters

$date

stringintegerarray\Zend_Date

Date to set

$format

string

OPTIONAL Date format for parsing

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

\Zend_DateProvides a fluent interface

Sets a new day The day can be a number or a string. Setting days lower then 0 or greater than the number of this months days will result in adding or subtracting the relevant month.

setDay(string|integer|array|\Zend_Date $day, string|\Zend_Locale $locale = null) : \Zend_Date

If a localized dayname is given it will be parsed with the default locale or the optional set locale. Returned is the new date object Example: setDay('Montag', 'de_AT'); will set the monday of this week as day.

Parameters

$day

stringintegerarray\Zend_Date

Day to set

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

\Zend_DateProvides a fluent interface

Sets a new day of year The day of year is always a number.

setDayOfYear(string|integer|array|\Zend_Date $day, string|\Zend_Locale $locale = null) : \Zend_Date

Returned is the new date object Example: 04.May.2004 -> setDayOfYear(10) -> 10.Jan.2004

Parameters

$day

stringintegerarray\Zend_Date

Day of Year to set

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

\Zend_DateProvides a fluent interface

Sets a new precision for fractional seconds

setFractionalPrecision(integer $precision) : \Zend_Date

Parameters

$precision

integer

Precision for the fractional datepart 3 = milliseconds

Exceptions

\Zend_Date_Exception

Returns

\Zend_DateProvides a fluent interface

Sets a new hour The hour is always a number.

setHour(string|integer|array|\Zend_Date $hour, string|\Zend_Locale $locale = null) : \Zend_Date

Returned is the new date object Example: 04.May.1993 13:07:25 -> setHour(7); -> 04.May.1993 07:07:25

Parameters

$hour

stringintegerarray\Zend_Date

Hour to set

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

\Zend_DateProvides a fluent interface

Sets a new date for the date object. Not given parts are set to default.

setIso(string|integer|\Zend_Date $date, string|\Zend_Locale $locale = null) : \Zend_Date

Only supported ISO 8601 formats are accepted. For example: 050901 -> 01.Sept.2005 00:00:00, 20050201T10:00:30 -> 01.Feb.2005 10h00m30s Returned is the new date object

Parameters

$date

stringinteger\Zend_Date

ISO Date to set

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

\Zend_DateProvides a fluent interface

Sets a new standard locale for the date object.

setLocale(string|\Zend_Locale $locale = null) : \Zend_Date

This locale will be used for all functions Returned is the really set locale. Example: 'de_XX' will be set to 'de' because 'de_XX' does not exist 'xx_YY' will be set to 'root' because 'xx' does not exist

Parameters

$locale

string\Zend_Locale

(Optional) Locale for parsing input

Exceptions

\Zend_Date_Exception When the given locale does not exist

Returns

\Zend_DateProvides fluent interface

Sets new milliseconds for the date object Example: setMilliSecond(550, 2) -> equals +5 Sec +50 MilliSec

setMilliSecond(integer|\Zend_Date $milli = null, integer $precision = null) : \Zend_Date

Parameters

$milli

integer\Zend_Date

(Optional) Millisecond to set, when null the actual millisecond is set

$precision

integer

(Optional) Fraction precision of the given milliseconds

Exceptions

\Zend_Date_Exception

Returns

\Zend_DateProvides a fluent interface

Sets a new minute The minute is always a number.

setMinute(string|integer|array|\Zend_Date $minute, string|\Zend_Locale $locale = null) : \Zend_Date

Returned is the new date object Example: 04.May.1993 13:07:25 -> setMinute(29); -> 04.May.1993 13:29:25

Parameters

$minute

stringintegerarray\Zend_Date

Minute to set

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

\Zend_DateProvides a fluent interface

Sets a new month The month can be a number or a string. Setting months lower then 0 and greater then 12 will result in adding or subtracting the relevant year. (12 months equal one year) If a localized monthname is given it will be parsed with the default locale or the optional set locale.

setMonth(string|integer|array|\Zend_Date $month, string|\Zend_Locale $locale = null) : \Zend_Date

Returned is the new date object

Parameters

$month

stringintegerarray\Zend_Date

Month to set

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

\Zend_DateProvides a fluent interface

Sets class wide options, if no option was given, the actual set options will be returned

setOptions(array $options = array()) : \Options
Static

Parameters

$options

array

Options to set

Exceptions

\Zend_Date_Exception

Returns

\Optionsarray if no option was given

Sets new seconds to the existing date object.

setSecond(string|integer|array|\Zend_Date $second, string|\Zend_Locale $locale = null) : \Zend_Date

The second is always a number. Returned is the new date object Example: 04.May.1993 13:07:25 -> setSecond(100); -> 04.May.1993 13:08:40

Parameters

$second

stringintegerarray\Zend_Date

Second to set

$locale

string\Zend_Locale

(Optional) Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

\Zend_DateProvides a fluent interface

Sets a new time for the date object. Format defines how to parse the time string.

setTime(string|integer|array|\Zend_Date $time, string $format = null, string|\Zend_Locale $locale = null) : \Zend_Date

Also a complete date can be given, but only the time is used for setting. For example: dd.MMMM.yyTHH:mm' and 'ss sec'-> 10.May.07T25:11 and 44 sec => 1h11min44sec + 1 day Returned is the new date object and the existing date is left as it was before

Parameters

$time

stringintegerarray\Zend_Date

Time to set

$format

string

OPTIONAL Timeformat for parsing input

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

\Zend_DateProvides a fluent interface

Sets a new timestamp

setTimestamp(integer|string|array|\Zend_Date $timestamp) : \Zend_Date

Parameters

$timestamp

integerstringarray\Zend_Date

Timestamp to set

Exceptions

\Zend_Date_Exception

Returns

\Zend_DateProvides a fluent interface

Sets a new timezone for calculation of $this object's gmt offset.

setTimezone(string $zone = null) : \Zend_Date_DateObject
Inherited

For a list of supported timezones look here: http://php.net/timezones If no timezone can be detected or the given timezone is wrong UTC will be set.

Parameters

$zone

string

OPTIONAL timezone for date calculation; defaults to date_default_timezone_get()

Exceptions

\Zend_Date_Exception

Returns

\Zend_Date_DateObjectProvides fluent interface

Sets a new week. The week is always a number. The day of week is not changed.

setWeek(string|integer|array|\Zend_Date $week, string|\Zend_Locale $locale = null) : \Zend_Date

Returned is the new date object Example: 09.Jan.2007 13:07:25 -> setWeek(1); -> 02.Jan.2007 13:07:25

Parameters

$week

stringintegerarray\Zend_Date

Week to set

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

\Zend_DateProvides a fluent interface

Sets a new weekday The weekday can be a number or a string. If a localized weekday name is given, then it will be parsed as a date in $locale (defaults to the same locale as $this).

setWeekday(string|integer|array|\Zend_Date $weekday, string|\Zend_Locale $locale = null) : \Zend_Date

Returned is the new date object. Example: setWeekday(3); will set the wednesday of this week as day.

Parameters

$weekday

stringintegerarray\Zend_Date

Weekday to set

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

\Zend_DateProvides a fluent interface

Sets a new year If the year is between 0 and 69, 2000 will be set (2000-2069) If the year if between 70 and 99, 1999 will be set (1970-1999) 3 or 4 digit years are set as expected. If you need to set year 0-99 use set() instead.

setYear(string|integer|array|\Zend_Date $year, string|\Zend_Locale $locale = null) : \Zend_Date

Returned is the new date object

Parameters

$year

stringintegerarray\Zend_Date

Year to set

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

\Zend_DateProvides a fluent interface

Subtracts a date from another date.

sub(string|integer|array|\Zend_Date $date, string $part = self::TIMESTAMP, string|\Zend_Locale $locale = null) : \Zend_Date

This could be for example a RFC2822 date, the time, the year or only the timestamp. There are about 50 different supported date parts. For a complete list of supported datepart values look into the docu Be aware: Adding -2 Months is not equal to Subtracting 2 Months !!!

Parameters

$date

stringintegerarray\Zend_Date

Date or datepart to subtract

$part

string

OPTIONAL Part of the date to sub, if null the timestamp is subtracted

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

\Zend_DateProvides a fluent interface

Subtracts a RFC 822 date from the date object.

subArpa(string|integer|\Zend_Date $date, string|\Zend_Locale $locale = null) : \Zend_Date

ARPA messages are used in emails or HTTP Headers. Only RFC 822 compilant date strings are accepted. For example: Sat, 14 Feb 09 00:31:30 +0100 Returned is the new date object

Parameters

$date

stringinteger\Zend_Date

RFC 822 Date to sub

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

\Zend_DateProvides a fluent interface

Subtracts a date from the existing date object. Format defines how to parse the date string.

subDate(string|integer|array|\Zend_Date $date, string $format = null, string|\Zend_Locale $locale = null) : \Zend_Date

If only parts are given the other parts are set to 0. If no format is given, the standardformat of this locale is used. For example: MM.dd.YYYY -> 10 -> -10 months Be aware: Subtracting 2 months is not equal to Adding -2 months !!!

Parameters

$date

stringintegerarray\Zend_Date

Date to sub

$format

string

OPTIONAL Date format for parsing input

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

\Zend_DateProvides a fluent interface

Subtracts days from the existing date object.

subDay(string|integer|array|\Zend_Date $day, string|\Zend_Locale $locale = null) : \Zend_Date

The day can be a number or a string. Subtracting days lower then 0 or greater than the number of this months days will result in adding or subtracting the relevant month. If a localized dayname is given it will be parsed with the default locale or the optional set locale.

Parameters

$day

stringintegerarray\Zend_Date

Day to sub

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

\Zend_DateProvides a fluent interface

Subtracts a day of year from the existing date object.

subDayOfYear(string|integer|array|\Zend_Date $day, string|\Zend_Locale $locale = null) : \Zend_Date

The day of year is always a number. Returned is the new date object Example: subDayOfYear(10); will subtract 10 days from the existing date object.

Parameters

$day

stringintegerarray\Zend_Date

Day of Year to sub

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

\Zend_DateProvides a fluent interface

Subtracts hours from the existing date object.

subHour(string|integer|array|\Zend_Date $hour, string|\Zend_Locale $locale = null) : \Zend_Date

The hour is always a number. Returned is the new date object Example: 04.May.1993 13:07:25 -> subHour(6); -> 05.May.1993 07:07:25

Parameters

$hour

stringintegerarray\Zend_Date

Hour to sub

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

\Zend_DateProvides a fluent interface

Subtracts a ISO date from the date object. Not given parts are set to default.

subIso(string|integer|\Zend_Date $date, string|\Zend_Locale $locale = null) : \Zend_Date

Only supported ISO 8601 formats are accepted. For example: 050901 -> - 01.Sept.2005 00:00:00, 10:00:00 -> -10h Returned is the new date object

Parameters

$date

stringinteger\Zend_Date

ISO Date to sub

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

\Zend_DateProvides a fluent interface

Subtracts a millisecond

subMilliSecond(integer|\Zend_Date $milli = null, integer $precision = null) : \Zend_Date

Parameters

$milli

integer\Zend_Date

(Optional) Millisecond to sub, when null the actual millisecond is subtracted

$precision

integer

(Optional) Fractional precision for the given milliseconds

Returns

\Zend_DateProvides a fluent interface

Subtracts minutes from the existing date object.

subMinute(string|integer|array|\Zend_Date $minute, string|\Zend_Locale $locale = null) : \Zend_Date

The minute is always a number. Returned is the new date object Example: 04.May.1993 13:07:25 -> subMinute(9); -> 04.May.1993 12:58:25

Parameters

$minute

stringintegerarray\Zend_Date

Minute to sub

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

\Zend_DateProvides a fluent interface

Subtracts months from the existing date object.

subMonth(string|integer|array|\Zend_Date $month, string|\Zend_Locale $locale = null) : \Zend_Date

The month can be a number or a string. Subtracting months lower then 0 and greater then 12 will result in adding or subtracting the relevant year. (12 months equal one year) If a localized monthname is given it will be parsed with the default locale or the optional set locale. Returned is the new date object

Parameters

$month

stringintegerarray\Zend_Date

Month to sub

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

\Zend_DateProvides a fluent interface

Subtracts seconds from the existing date object.

subSecond(string|integer|array|\Zend_Date $second, string|\Zend_Locale $locale = null) : \Zend_Date

The second is always a number. Returned is the new date object Example: 04.May.1993 13:07:25 -> subSecond(10); -> 04.May.1993 13:07:15

Parameters

$second

stringintegerarray\Zend_Date

Second to sub

$locale

string\Zend_Locale

(Optional) Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

\Zend_DateProvides a fluent interface

Subtracts a time from the existing date. Format defines how to parse the time string.

subTime(string|integer|array|\Zend_Date $time, string $format = null, string|\Zend_Locale $locale = null) : \Zend_Date

If only parts are given the other parts are set to 0. If no format is given, the standardformat of this locale is used. For example: HH:mm:ss -> 10 -> -10 hours

Parameters

$time

stringintegerarray\Zend_Date

Time to sub

$format

string

OPTIONAL Timeformat for parsing input

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

\Zend_DateProvides a fluent inteface

Subtracts a timestamp

subTimestamp(integer|string|array|\Zend_Date $timestamp) : \Zend_Date

Parameters

$timestamp

integerstringarray\Zend_Date

Timestamp to sub

Exceptions

\Zend_Date_Exception

Returns

\Zend_DateProvides a fluent interface

Subtracts a week. The week is always a number. The day of week is not changed.

subWeek(string|integer|array|\Zend_Date $week, string|\Zend_Locale $locale = null) : \Zend_Date

Returned is the new date object Example: 09.Jan.2007 13:07:25 -> subWeek(1); -> 02.Jan.2007 13:07:25

Parameters

$week

stringintegerarray\Zend_Date

Week to sub

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

\Zend_DateProvides a fluent interface

Subtracts weekdays from the existing date object.

subWeekday(string|integer|array|\Zend_Date $weekday, string|\Zend_Locale $locale = null) : \Zend_Date

The weekday can be a number or a string. If a localized dayname is given it will be parsed with the default locale or the optional set locale. Returned is the new date object Example: subWeekday(3); will subtract the difference of days from the begining of the month until wednesday.

Parameters

$weekday

stringintegerarray\Zend_Date

Weekday to sub

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

\Zend_DateProvides a fluent interface

Subs the year from the existing date object If the year is between 0 and 69, 2000 will be subtracted (2000-2069) If the year if between 70 and 99, 1999 will be subtracted (1970-1999) 3 or 4 digit years are subtracted as expected. If you need to subtract years from 0-99 use sub() instead.

subYear(string|integer|array|\Zend_Date $year, string|\Zend_Locale $locale = null) : \Zend_Date

Returned is the new date object

Parameters

$year

stringintegerarray\Zend_Date

Year to sub

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

\Zend_DateProvides a fluent interface

Returns an array representation of the object

toArray() : array

Returns

array

Returns a string representation of the object Supported format tokens are: G - era, y - year, Y - ISO year, M - month, w - week of year, D - day of year, d - day of month E - day of week, e - number of weekday (1-7), h - hour 1-12, H - hour 0-23, m - minute, s - second A - milliseconds of day, z - timezone, Z - timezone offset, S - fractional second, a - period of day

toString(string $format = null, string $type = null, string|\Zend_Locale $locale = null) : string

Additionally format tokens but non ISO conform are: SS - day suffix, eee - php number of weekday(0-6), ddd - number of days per month l - Leap year, B - swatch internet time, I - daylight saving time, X - timezone offset in seconds r - RFC2822 format, U - unix timestamp

Not supported ISO tokens are u - extended year, Q - quarter, q - quarter, L - stand alone month, W - week of month F - day of week of month, g - modified julian, c - stand alone weekday, k - hour 0-11, K - hour 1-24 v - wall zone

Parameters

$format

string

OPTIONAL Rule for formatting output. If null the default date format is used

$type

string

OPTIONAL Type for the format string which overrides the standard setting

$locale

string\Zend_Locale

OPTIONAL Locale for parsing input

Returns

string

Returns a integer representation of the object But returns false when the given part is no value f.e. Month-Name

toValue(string|integer|\Zend_Date $part = null) : integer | false

Parameters

$part

stringinteger\Zend_Date

OPTIONAL Defines the date or datepart to return as integer

Returns

integerfalse

Returns the ISO Token for all localized constants

_getLocalizedToken(string $token, string $locale) : string
Static

Parameters

$token

string

Token to normalize

$locale

string

Locale to search

Returns

string

Internal method to check if the given cache supports tags

_getTagSupportForCache() 
InheritedStatic

Internal function.

_getTime(integer $sync = null) : integer
Inherited

Returns time(). This method exists to allow unit tests to work-around methods that might otherwise be hard-coded to use time(). For example, this makes it possible to test isYesterday() in Date.php.

Parameters

$sync

integer

OPTIONAL time syncronisation value

Returns

integertimestamp

Calculates the sunrise or sunset based on a location

calcSun(array $location, boolean $horizon, $rise = false) : mixed
Inherited

Parameters

$location

array

Location for calculation MUST include 'latitude', 'longitude', 'horizon'

$horizon

boolean

true: sunrise; false: sunset

$rise

Returns

mixed- false: midnight sun, integer:

Internal mktime function used by Zend_Date for handling 64bit timestamps.

date(string $format, mixed $timestamp = null, boolean $gmt = false) : string
Inherited

Returns a formatted date for a given timestamp.

Parameters

$format

string

format for output

$timestamp

mixed

$gmt

boolean

OPTIONAL true = other arguments are for UTC time, false = arguments are for local time/date

Returns

string

Returns the day of week for a Gregorian calendar date.

dayOfWeek(integer $year, integer $month, integer $day) : integer
InheritedStatic

0 = sunday, 6 = saturday

Parameters

$year

integer

$month

integer

$day

integer

Returns

integerdayOfWeek

Internal getDateParts function for handling 64bit timestamps, similar to: http://www.php.net/getdate

getDateParts(mixed $timestamp = null, boolean $fast = null) : array
Inherited

Returns an array of date parts for $timestamp, relative to 1970/01/01 00:00:00 GMT/UTC.

$fast specifies ALL date parts should be returned (slower) Default is false, and excludes $dayofweek, weekday, month and timestamp from parts returned.

Parameters

$timestamp

mixed

$fast

boolean

OPTIONAL defaults to fast (false), resulting in fewer date parts

Returns

array

Returns this object's UNIX timestamp A timestamp greater then the integer range will be returned as string This function does not return the timestamp as object. Use copy() instead.

getUnixTimestamp() : integer | string
Inherited

Returns

integerstringtimestamp

Returns true, if given $year is a leap year.

isYearLeapYear(integer $year) : boolean
InheritedStatic

Parameters

$year

integer

Returns

booleantrue, if year is leap year

Internal mktime function used by Zend_Date.

mktime(integer $hour, integer $minute, integer $second, integer $month, integer $day, integer $year, boolean $gmt = false) : integer | float
Inherited

The timestamp returned by mktime() can exceed the precision of traditional UNIX timestamps, by allowing PHP to auto-convert to using a float value.

Returns a timestamp relative to 1970/01/01 00:00:00 GMT/UTC. DST (Summer/Winter) is depriciated since php 5.1.0. Year has to be 4 digits otherwise it would be recognised as year 70 AD instead of 1970 AD as expected !!

Parameters

$hour

integer

$minute

integer

$second

integer

$month

integer

$day

integer

$year

integer

$gmt

boolean

OPTIONAL true = other arguments are for UTC time, false = arguments are for local time/date

Returns

integerfloattimestamp (number of seconds elapsed relative to 1970/01/01 00:00:00 GMT/UTC)

Set this object to have a new UNIX timestamp.

setUnixTimestamp(string|integer $timestamp = null) : string | integer
Inherited

Parameters

$timestamp

stringinteger

OPTIONAL timestamp; defaults to local time using time()

Exceptions

\Zend_Date_Exception

Returns

stringintegerold timestamp

Internal getWeekNumber function for handling 64bit timestamps

weekNumber(integer $year, integer $month, integer $day) : integer
Inherited

Returns the ISO 8601 week number of a given date

Parameters

$year

integer

$month

integer

$day

integer

Returns

integer

Calculates the date or object

_assign(string $calc, string|integer $date, string|integer $comp = 0, boolean|integer $dst = false) : integer | string | \Zend_Date

Parameters

$calc

string

Calculation to make

$date

stringinteger

Date for calculation

$comp

stringinteger

Second date for calculation

$dst

booleaninteger

Use dst correction if option is set

Returns

integerstring\Zend_Datenew timestamp or Zend_Date depending on calculation

Calculate date details

_calcdetail(string $calc, string|integer|array|\Zend_Date $date, string $type, string|\Zend_Locale $locale) : integer | string

Parameters

$calc

string

Calculation to make

$date

stringintegerarray\Zend_Date

Date or Part to calculate

$type

string

Datepart for Calculation

$locale

string\Zend_Locale

Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

integerstringnew date

Calculates the date or object

_calculate(string $calc, string|integer|array|\Zend_Date $date, string $part, string|\Zend_Locale $locale) : integer | string | \Zend_Date

Parameters

$calc

string

Calculation to make, one of: 'add'|'sub'|'cmp'|'copy'|'set'

$date

stringintegerarray\Zend_Date

Date or datepart to calculate with

$part

string

Part of the date to calculate, if null the timestamp is used

$locale

string\Zend_Locale

Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

integerstring\Zend_Datenew timestamp

Internal calculation, returns the requested date type

_calcvalue(string $calc, string|integer|\Zend_Date $value, string $type, string $parameter, string|\Zend_Locale $locale) : integer | \Zend_Date

Parameters

$calc

string

Calculation to make

$value

stringinteger\Zend_Date

Datevalue to calculate with, if null the actual value is taken

$type

string

$parameter

string

$locale

string\Zend_Locale

Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

integer\Zend_Datenew date

Check if location is supported

_checkLocation(array $location) : float

Parameters

$location

array

locations array

Exceptions

\Zend_Date_Exception

Returns

float$horizon float

Returns the calculated date

_date(string $calc, string|integer|array|\Zend_Date $date, string $format, string|\Zend_Locale $locale) : integer | \Zend_Date

Parameters

$calc

string

Calculation to make

$date

stringintegerarray\Zend_Date

Date to calculate with, if null the actual date is taken

$format

string

Date format for parsing

$locale

string\Zend_Locale

Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

integer\Zend_Datenew date

Returns the calculated day

_day(string $calc, \Zend_Date $day, \Zend_Locale $locale) : \Zend_Date | integer

Parameters

$calc

string

Type of calculation to make

$day

\Zend_Date

Day to calculate, when null the actual day is calculated

$locale

\Zend_Locale

Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

\Zend_Dateinteger

Return digit from standard names (english) Faster implementation than locale aware searching

_getDigitFromName(string $name) : integer

Parameters

$name

string

Exceptions

\Zend_Date_Exception

Returns

integerNumber of this month

Returns the calculated month

_month(string $calc, string|integer|array|\Zend_Date $month, string|\Zend_Locale $locale) : integer | \Zend_Date

Parameters

$calc

string

Calculation to make

$month

stringintegerarray\Zend_Date

Month to calculate with, if null the actual month is taken

$locale

string\Zend_Locale

Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

integer\Zend_Datenew time

Internal parsing method

_parseIsoToDate(string $token, string $locale) : string

Parameters

$token

string

$locale

string

Returns

string

Internal _range function Sets the value $a to be in the range of [0, $b]

_range(float $a, float $b) 
Inherited

Parameters

$a

float
  • value to correct

$b

float
  • maximum range to set

Returns the calculated time

_time(string $calc, string|integer|array|\Zend_Date $time, string $format, string|\Zend_Locale $locale) : integer | \Zend_Date

Parameters

$calc

string

Calculation to make

$time

stringintegerarray\Zend_Date

Time to calculate with, if null the actual time is taken

$format

string

Timeformat for parsing input

$locale

string\Zend_Locale

Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

integer\Zend_Datenew time

Returns the calculated timestamp HINT: timestamps are always GMT

_timestamp(string $calc, string|integer|array|\Zend_Date $stamp) : \Zend_Date | integer

Parameters

$calc

string

Type of calculation to make

$stamp

stringintegerarray\Zend_Date

Timestamp to calculate, when null the actual timestamp is calculated

Exceptions

\Zend_Date_Exception

Returns

\Zend_Dateinteger

Private function to make a comment of a token

_toComment(string $token) : string

Parameters

$token

string

Returns

string

Internal method to apply tokens

_toToken(string $part, string $locale) : string

Parameters

$part

string

$locale

string

Returns

string

Returns the calculated weekday

_weekday(string $calc, \Zend_Date $weekday, \Zend_Locale $locale) : \Zend_Date | integer

Parameters

$calc

string

Type of calculation to make

$weekday

\Zend_Date

Weekday to calculate, when null the actual weekday is calculated

$locale

\Zend_Locale

Locale for parsing input

Exceptions

\Zend_Date_Exception

Returns

\Zend_Dateinteger

 Properties

 

$_cache

$_cache 

Default

null
Static
 

$_cacheTags

$_cacheTags 

Default

false
Static
 

$_defaultOffset

$_defaultOffset 

Default

0
Static
 

$_dst

$_dst 

Default

true
 

$_fractional

$_fractional 

Default

0
 

$_locale

$_locale 

Default

null
 

Table of Monthdays

$_monthTable 

Default

array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
Static
 

$_offset

$_offset 

Default

0
 

$_options

$_options 

Default

array('format_type' => 'iso', 'fix_dst' => true, 'extend_month' => false, 'cache' => null, 'timesync' => null)
Static
 

$_precision

$_precision 

Default

3
 

$_syncronised

$_syncronised 

Default

0
 

active timezone

$_timezone 

Default

'UTC'
 

UNIX Timestamp

$_unixTimestamp 

Default

 

Table of Years

$_yearTable 

Default

array(1970 => 0, 1960 => -315619200, 1950 => -631152000, 1940 => -946771200, 1930 => -1262304000, 1920 => -1577923200, 1910 => -1893456000, 1900 => -2208988800, 1890 => -2524521600, 1880 => -2840140800, 1870 => -3155673600, 1860 => -3471292800, 1850 => -3786825600, 1840 => -4102444800, 1830 => -4417977600, 1820 => -4733596800, 1810 => -5049129600, 1800 => -5364662400, 1790 => -5680195200, 1780 => -5995814400, 1770 => -6311347200, 1760 => -6626966400, 1750 => -6942499200, 1740 => -7258118400, 1730 => -7573651200, 1720 => -7889270400, 1710 => -8204803200, 1700 => -8520336000, 1690 => -8835868800, 1680 => -9151488000, 1670 => -9467020800, 1660 => -9782640000, 1650 => -10098172800, 1640 => -10413792000, 1630 => -10729324800, 1620 => -11044944000, 1610 => -11360476800, 1600 => -11676096000)
Static

 Constants

 

ATOM

ATOM = 'OOO' 
   

DATES

DATES = 'F' 
 

DATETIME

DATETIME = 'K' 
 

DATETIME_FULL

DATETIME_FULL = 'KKKKK' 
 

DATETIME_LONG

DATETIME_LONG = 'KKKK' 
 

DATETIME_MEDIUM

DATETIME_MEDIUM = 'KKK' 
 

DATETIME_SHORT

DATETIME_SHORT = 'KK' 
 

DATE_FULL

DATE_FULL = 'FFFFF' 
 

DATE_LONG

DATE_LONG = 'FFFF' 
 

DATE_MEDIUM

DATE_MEDIUM = 'FFF' 
 

DATE_SHORT

DATE_SHORT = 'FF' 
 

DAY

DAY = 'dd' 
 

DAYLIGHT

DAYLIGHT = 'I' 
 

DAY_OF_YEAR

DAY_OF_YEAR = 'D' 
 

DAY_SHORT

DAY_SHORT = 'd' 
 

DAY_SUFFIX

DAY_SUFFIX = 'SS' 
 

ERA

ERA = 'G' 
 

ERA_NAME

ERA_NAME = 'GGGG' 
 

ERA_NARROW

ERA_NARROW = 'GGGGG' 
 

GMT_DIFF

GMT_DIFF = 'Z' 
 

GMT_DIFF_SEP

GMT_DIFF_SEP = 'ZZZZ' 
 

HOUR

HOUR = 'HH' 
 

HOUR_AM

HOUR_AM = 'hh' 
 

HOUR_SHORT

HOUR_SHORT = 'H' 
 

HOUR_SHORT_AM

HOUR_SHORT_AM = 'h' 
 

ISO_8601

ISO_8601 = 'c' 
 

LEAPYEAR

LEAPYEAR = 'l' 
 

MERIDIEM

MERIDIEM = 'a' 
 

MILLISECOND

MILLISECOND = 'S' 
 

MINUTE

MINUTE = 'mm' 
 

MINUTE_SHORT

MINUTE_SHORT = 'm' 
 

MONTH

MONTH = 'MM' 
 

MONTH_DAYS

MONTH_DAYS = 'ddd' 
 

MONTH_NAME

MONTH_NAME = 'MMMM' 
 

MONTH_NAME_NARROW

MONTH_NAME_NARROW = 'MMMMM' 
 

MONTH_NAME_SHORT

MONTH_NAME_SHORT = 'MMM' 
 

MONTH_SHORT

MONTH_SHORT = 'M' 
 

RFC_1036

RFC_1036 = 'RRR' 
 

RFC_1123

RFC_1123 = 'RRRR' 
 

RFC_2822

RFC_2822 = 'r' 
 

RFC_3339

RFC_3339 = 'RRRRR' 
 

RFC_822

RFC_822 = 'R' 
 

RFC_850

RFC_850 = 'RR' 
 

RSS

RSS = 'SSS' 
 

SECOND

SECOND = 'ss' 
 

SECOND_SHORT

SECOND_SHORT = 's' 
 

SWATCH

SWATCH = 'B' 
 

TIMES

TIMES = 'WW' 
 

TIMESTAMP

TIMESTAMP = 'U' 
 

TIMEZONE

TIMEZONE = 'z' 
 

TIMEZONE_NAME

TIMEZONE_NAME = 'zzzz' 
 

TIMEZONE_SECS

TIMEZONE_SECS = 'X' 
 

TIME_FULL

TIME_FULL = 'TTTTT' 
 

TIME_LONG

TIME_LONG = 'TTTT' 
 

TIME_MEDIUM

TIME_MEDIUM = 'TTT' 
 

TIME_SHORT

TIME_SHORT = 'TT' 
 

W3C

W3C = 'WWW' 
 

WEEK

WEEK = 'ww' 
 

WEEKDAY

WEEKDAY = 'EEEE' 
 

WEEKDAY_8601

WEEKDAY_8601 = 'eee' 
 

WEEKDAY_DIGIT

WEEKDAY_DIGIT = 'e' 
 

WEEKDAY_NAME

WEEKDAY_NAME = 'EE' 
 

WEEKDAY_NARROW

WEEKDAY_NARROW = 'E' 
 

WEEKDAY_SHORT

WEEKDAY_SHORT = 'EEE' 
 

YEAR

YEAR = 'y' 
 

YEAR_8601

YEAR_8601 = 'Y' 
 

YEAR_SHORT

YEAR_SHORT = 'yy' 
 

YEAR_SHORT_8601

YEAR_SHORT_8601 = 'YY'