Date/DateObject.php

Show: PublicProtectedPrivateinherited
Table of Contents
Zend Framework
LICENSE This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  
Package
Zend_Date  
Version
$Id$  

\Zend_Date_DateObject

Package: Zend_Date\Zend_Date_DateObject
Children
\Zend_Date
Category
Zend  
Copyright
Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)  
License
New BSD License  

Properties

>VPropertyprotected$_cache = null
static
Default valuenullDetails
Type
n/a
>VPropertyprotected$_cacheTags = false
static
Default valuefalseDetails
Type
n/a
>VPropertyprotected$_defaultOffset = 0
static
Default value0Details
Type
n/a
>VPropertyprotected$_dst = true
Default valuetrueDetails
Type
n/a
>VPropertyprivate$_monthTable = array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
static
Table of Monthdays
Default valuearray(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)Details
Type
n/a
>VPropertyprivate$_offset = 0
Default value0Details
Type
n/a
>VPropertyprivate$_syncronised = 0
Default value0Details
Type
n/a
>VPropertyprivate$_timezone = 'UTC'
active timezone
Default value'UTC'Details
Type
n/a
>VPropertyprivate$_unixTimestamp
UNIX Timestamp
Details
Type
n/a
>VPropertyprivate$_yearTable = 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
Table of Years
Default valuearray(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)Details
Type
n/a

Methods

methodprotected_getTagSupportForCache() : void
static

Internal method to check if the given cache supports tags

methodprotected_getTime(integer $sync = null) : integer

Internal function.

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
NameTypeDescription
$syncinteger

OPTIONAL time syncronisation value

Returns
TypeDescription
integertimestamp
methodprivate_range(float $a, float $b) : void

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

Parameters
NameTypeDescription
$afloat
  • value to correct
$bfloat
  • maximum range to set
methodprotectedcalcSun(array $location, bool $horizon,  $rise = false) : mixed

Calculates the sunrise or sunset based on a location

Parameters
NameTypeDescription
$locationarray

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

$horizonbool

true: sunrise; false: sunset

$rise
Returns
TypeDescription
mixed- false: midnight sun, integer:
methodprotecteddate(string $format, mixed $timestamp = null, boolean $gmt = false) : string

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

Returns a formatted date for a given timestamp.
Parameters
NameTypeDescription
$formatstring

format for output

$timestampmixed
$gmtboolean

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

Returns
TypeDescription
string
methodprotecteddayOfWeek(integer $year, integer $month, integer $day) : integer
static

Returns the day of week for a Gregorian calendar date.

0 = sunday, 6 = saturday
Parameters
NameTypeDescription
$yearinteger
$monthinteger
$dayinteger
Returns
TypeDescription
integerdayOfWeek
methodprotectedgetDateParts(mixed $timestamp = null, boolean $fast = null) : array

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

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
NameTypeDescription
$timestampmixed
$fastboolean

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

Returns
TypeDescription
array
methodpublicgetGmtOffset() : integer

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

The offset to GMT is initially set when the object is instantiated using the currently, in effect, default timezone for PHP functions.
Returns
TypeDescription
integerseconds difference between GMT timezone and timezone when object was instantiated
methodpublicgetTimezone() : string

Return the timezone of $this object.

The timezone is initially set when the object is instantiated.
Returns
TypeDescription
stringactual set timezone string
methodprotectedgetUnixTimestamp() : integer | string

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.

Returns
TypeDescription
integer | stringtimestamp
methodprotectedisYearLeapYear(integer $year) : boolean
static

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

Parameters
NameTypeDescription
$yearinteger
Returns
TypeDescription
booleantrue, if year is leap year
methodprotectedmktime(integer $hour, integer $minute, integer $second, integer $month, integer $day, integer $year, boolean $gmt = false) : integer | float

Internal mktime function used by Zend_Date.

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
NameTypeDescription
$hourinteger
$minuteinteger
$secondinteger
$monthinteger
$dayinteger
$yearinteger
$gmtboolean

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

Returns
TypeDescription
integer | floattimestamp (number of seconds elapsed relative to 1970/01/01 00:00:00 GMT/UTC)
methodpublicsetTimezone(string $zone = null) : \Zend_Date_DateObject

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

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
NameTypeDescription
$zonestring

OPTIONAL timezone for date calculation; defaults to date_default_timezone_get()

Returns
TypeDescription
\Zend_Date_DateObjectProvides fluent interface
Throws
ExceptionDescription
\Zend_Date_Exception
methodprotectedsetUnixTimestamp(string | integer $timestamp = null) : string | integer

Set this object to have a new UNIX timestamp.

Parameters
NameTypeDescription
$timestampstring | integer

OPTIONAL timestamp; defaults to local time using time()

Returns
TypeDescription
string | integerold timestamp
Throws
ExceptionDescription
\Zend_Date_Exception
methodprotectedweekNumber(integer $year, integer $month, integer $day) : integer

Internal getWeekNumber function for handling 64bit timestamps

Returns the ISO 8601 week number of a given date
Parameters
NameTypeDescription
$yearinteger
$monthinteger
$dayinteger
Returns
TypeDescription
integer
Documentation was generated by phpDocumentor 2.2.0 .