API Documentation

Date/DateObject.php

Classes 
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Date
version
$Id: DateObject.php 22071 2010-05-01 17:25:23Z thomas $
Classes
Zend_Date_DateObject

Description

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.

Zend_Date_DateObject

category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Date
subpackage
Zend_Date_DateObject
Properties
$_unixTimestamp
$_cache
$_defaultOffset
$_timezone
$_offset
$_syncronised
$_dst
$_monthTable
$_yearTable
Methods
setUnixTimestamp
getUnixTimestamp
_getTime
mktime
isYearLeapYear
date
dayOfWeek
getDateParts
weekNumber
_range
calcSun
setTimezone
getTimezone
getGmtOffset

Description

Properties

$_cache

 $_cache = 'null'

Details

visibility
protected
default
null
final
false
static
true

$_defaultOffset

 $_defaultOffset = '0'

Details

visibility
protected
default
0
final
false
static
true

$_dst

 $_dst = 'true'

Details

visibility
protected
default
true
final
false
static
false

$_monthTable

 $_monthTable = 'array'

Table of Monthdays

Details

visibility
private
default
array
final
false
static
true

$_offset

 $_offset = '0'

Details

visibility
private
default
0
final
false
static
false

$_syncronised

 $_syncronised = '0'

Details

visibility
private
default
0
final
false
static
false

$_timezone

 $_timezone = 'UTC'

active timezone

Details

visibility
private
default
UTC
final
false
static
false

$_unixTimestamp

 $_unixTimestamp = ''

UNIX Timestamp

Details

visibility
private
default
final
false
static
false

$_yearTable

 $_yearTable = 'array'

Table of Years

Details

visibility
private
default
array
final
false
static
true

Methods

_getTime

_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.

Arguments
$sync
integer
OPTIONAL time syncronisation value
Output
integer
timestamp
Details
visibility
protected
final
false
static
false

_range

_range( float $a, float $b ) :

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

Arguments
$a
float
- value to correct
$b
float
- maximum range to set
Details
visibility
private
final
false
static
false

calcSun

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

Calculates the sunrise or sunset based on a location

Arguments
$location
array
Location for calculation MUST include 'latitude', 'longitude', 'horizon'
$horizon
bool
true: sunrise; false: sunset
$rise
Output
mixed
- false: midnight sun, integer:
Details
visibility
protected
final
false
static
false

date

date( 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.

Arguments
$format
string
format for output
$timestamp
mixed
$gmt
boolean
OPTIONAL true = other arguments are for UTC time, false = arguments are for local time/date
Output
string
Details
visibility
protected
final
false
static
false

dayOfWeek

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

Returns the day of week for a Gregorian calendar date.

0 = sunday, 6 = saturday

Arguments
$year
integer
$month
integer
$day
integer
Output
integer
dayOfWeek
Details
visibility
protected
final
false
static
true

getDateParts

getDateParts( 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.

Arguments
$timestamp
mixed
$fast
boolean
OPTIONAL defaults to fast (false), resulting in fewer date parts
Output
array
Details
visibility
protected
final
false
static
false

getGmtOffset

getGmtOffset( ) : 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.

Output
integer
seconds difference between GMT timezone and timezone when object was instantiated
Details
visibility
public
final
false
static
false

getTimezone

getTimezone( ) : string

Return the timezone of $this object.

The timezone is initially set when the object is instantiated.

Output
string
actual set timezone string
Details
visibility
public
final
false
static
false

getUnixTimestamp

getUnixTimestamp( ) : 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.

Output
integer|string
timestamp
Details
visibility
protected
final
false
static
false

isYearLeapYear

isYearLeapYear( integer $year ) : boolean

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

Arguments
$year
integer
Output
boolean
true, if year is leap year
Details
visibility
protected
final
false
static
true

mktime

mktime( 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 !!

Arguments
$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
Output
integer|float
timestamp (number of seconds elapsed relative to 1970/01/01 00:00:00 GMT/UTC)
Details
visibility
protected
final
false
static
false

setTimezone

setTimezone( 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.

Arguments
$zone
string
OPTIONAL timezone for date calculation; defaults to date_default_timezone_get()
Output
Zend_Date_DateObject
Provides fluent interface
Details
visibility
public
final
false
static
false
throws

setUnixTimestamp

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

Set this object to have a new UNIX timestamp.

Arguments
$timestamp
stringinteger
OPTIONAL timestamp; defaults to local time using time()
Output
string|integer
old timestamp
Details
visibility
protected
final
false
static
false
throws

weekNumber

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

Internal getWeekNumber function for handling 64bit timestamps

Returns the ISO 8601 week number of a given date

Arguments
$year
integer
$month
integer
$day
integer
Output
integer
Details
visibility
protected
final
false
static
false
Documentation was generated by DocBlox.