Method |
Description |
|
__toString ( ) : string |
See {@link toString()}. |
|
addDay ( integer $n ) : Date |
Adds $n days to $this date and returns the result in a new Date. |
|
addHour ( integer $n ) : Date |
Adds $n hours to $this date and returns the result in a new Date. |
|
addHourTo ( integer $timestamp, number $n ) : integer |
Adds N number of hours to a UNIX timestamp and returns the result. Using
this static function instead of {@link addHour()} will be faster since a
Date instance does not have to be created. |
|
addPeriod ( integer $n, string $period ) : Date |
Adds a period to $this date and returns the result in a new Date instance. |
|
adjustForTimezone ( integer $timestamp, string $timezone ) : integer |
Converts a timestamp from UTC to a timezone. |
|
compareMonth ( Date $date ) : integer |
Performs three-way comparison of the month of the current date against the given $date's month. |
|
compareWeek ( Date $date ) : integer |
Performs three-way comparison of the week of the current date against the given $date's week. |
|
compareYear ( Date $date ) : integer |
Performs three-way comparison of the month of the current date against the given $date's year. |
|
factory ( string | integer $dateString, string $timezone = null ) : Date |
Creates a new Date instance using a string datetime value. The timezone of the Date
result will be in UTC. |
|
getDateEndUTC ( ) : string |
Returns the end of the day of the current timestamp in UTC. For example,
if the current timestamp is '2007-07-24 14:03:24' in UTC, the result will
be '2007-07-24 23:59:59'. |
|
getDateStartUTC ( ) : string |
Returns the start of the day of the current timestamp in UTC. For example,
if the current timestamp is '2007-07-24 14:04:24' in UTC, the result will
be '2007-07-24'. |
|
getDatetime ( ) : string |
Returns the current timestamp as a string with the following format: 'YYYY-MM-DD HH:MM:SS'. |
|
getDatetimeFromTimestamp ( integer $timestamp ) : string |
Returns the date in the "Y-m-d H:i:s" PHP format |
|
getHourUTC ( ) : string |
Returns the current hour in UTC timezone. |
|
getLocalized ( string $template ) : string |
Returns a localized date string using the given template. |
|
getTimestamp ( ) : integer |
Returns the unix timestamp of the date in UTC, converted from the current
timestamp timezone. |
|
getTimestampUTC ( ) : integer |
Returns the Unix timestamp of the date in UTC. |
|
getUtcOffset ( $timezone ) : integer |
Returns the offset to UTC time for the given timezone |
|
isEarlier ( Date $date ) : boolean |
Returns true if the current date is earlier than the given $date. |
|
isLater ( Date $date ) : boolean |
Returns true if the current date is older than the given $date. |
|
isLeapYear ( ) : boolean |
Returns true if the current year is a leap year, false otherwise. |
|
isToday ( ) : boolean |
Returns true if current date is today. |
|
now ( ) : Date |
Returns a date object set to now in UTC (same as {@link today()}, except that the time is also set). |
|
secondsToDays ( integer $secs ) : float |
Returns the number of days represented by a number of seconds. |
|
setDay ( integer $day ) : Date |
Returns a new Date instance with $this date's time of day and the day specified
by $day. |
|
setTime ( string $time ) : Date |
Returns a new Date instance with $this date's day and the specified new
time of day. |
|
setTimezone ( string $timezone ) : Date |
Returns a new date object with the same timestamp as $this but with a new
timezone. |
|
setYear ( integer $year ) : Date |
Returns a new Date instance with $this date's time of day, month and day, but with
a new year (specified by $year). |
|
subDay ( integer $n ) : Date |
Subtracts $n number of days from $this date and returns a new Date object. |
|
subHour ( integer $n ) : Date |
Subtracts $n hours from $this date and returns the result in a new Date. |
|
subMonth ( integer $n ) : Date |
Subtracts $n months from $this date and returns the result as a new Date object. |
|
subPeriod ( integer $n, string $period ) : Date |
Subtracts a period from $this date and returns the result in a new Date instance. |
|
subSeconds ( integer $n ) : Date |
Subtracts $n seconds from $this date and returns the result in a new Date. |
|
subWeek ( integer $n ) : Date |
Subtracts $n weeks from $this date and returns a new Date object. |
|
subYear ( integer $n ) : Date |
Subtracts $n years from $this date and returns the result as a new Date object. |
|
toString ( string $format = 'Y-m-d' ) : string |
Converts this date to the requested string format. See {@link http://php.net/date}
for the list of format strings. |
|
today ( ) : Date |
Returns a date object set to today at midnight in UTC. |
|
yesterday ( ) : Date |
Returns a date object set to yesterday at midnight in UTC. |
|
yesterdaySameTime ( ) : Date |
Returns a date object set to yesterday with the current time of day in UTC. |
|