BlueSpice MediaWiki master
 All Classes Namespaces Files Functions Variables Groups Pages
DateTime Class Reference
Inheritance diagram for DateTime:
Collaboration diagram for DateTime:

Public Member Functions

 __construct ($time='now', DateTimeZone $timezone=null)
 
 __wakeup ()
 
 format ($format)
 
 modify ($modify)
 
 add (DateInterval $interval)
 
 sub (DateInterval $interval)
 
 getTimezone ()
 
 setTimezone ($timezone)
 
 getOffset ()
 
 setTime ($hour, $minute, $second=0)
 
 setDate ($year, $month, $day)
 
 setISODate ($year, $week, $day=1)
 
 setTimestamp ($unixtimestamp)
 
 getTimestamp ()
 
 diff ($datetime2, $absolute=false)
 

Static Public Member Functions

static createFromFormat ($format, $time, DateTimeZone $timezone=null)
 
static getLastErrors ()
 
static __set_state ($array)
 

Public Attributes

const ATOM = 'Y-m-d\TH:i:sP'
 
const COOKIE = 'l, d-M-y H:i:s T'
 
const ISO8601 = 'Y-m-d\TH:i:sO'
 
const RFC822 = 'D, d M y H:i:s O'
 
const RFC850 = 'l, d-M-y H:i:s T'
 
const RFC1036 = 'D, d M y H:i:s O'
 
const RFC1123 = 'D, d M Y H:i:s O'
 
const RFC2822 = 'D, d M Y H:i:s O'
 
const RFC3339 = 'Y-m-d\TH:i:sP'
 
const RSS = 'D, d M Y H:i:s O'
 
const W3C = 'Y-m-d\TH:i:sP'
 

Detailed Description

Representation of date and time. http://php.net/manual/en/class.datetime.php

Constructor & Destructor Documentation

DateTime::__construct (   $time = 'now',
DateTimeZone  $timezone = null 
)

Member Function Documentation

static DateTime::__set_state (   $array)
static

The __set_state handler array $array Initialization array.

Returns
DateTime

Returns a new instance of a DateTime object.

DateTime::__wakeup ( )
DateTime::add ( DateInterval  $interval)

Adds an amount of days, months, years, hours, minutes and seconds to a DateTime object

Parameters
DateInterval$interval
Returns
static http://php.net/manual/en/datetime.add.php
static DateTime::createFromFormat (   $format,
  $time,
DateTimeZone  $timezone = null 
)
static

Parse a string into a new DateTime object according to the specified format

Parameters
string$formatFormat accepted by date().
string$timeString representing the time.
DateTimeZone$timezoneA DateTimeZone object representing the desired time zone.
Returns
DateTime|boolean http://php.net/manual/en/datetime.createfromformat.php
DateTime::diff (   $datetime2,
  $absolute = false 
)

Returns the difference between two DateTime objects represented as a DateInterval.

Parameters
DateTimeInterface$datetime2The date to compare to.
boolean$absolute[optional] Whether to return absolute difference.
Returns
DateInterval|boolean The DateInterval object representing the difference between the two dates or FALSE on failure. http://php.net/manual/en/datetime.diff.php

Implements DateTimeInterface.

DateTime::format (   $format)

Returns date formatted according to given format.

Parameters
string$format
Returns
string http://php.net/manual/en/datetime.format.php

Implements DateTimeInterface.

static DateTime::getLastErrors ( )
static

Returns an array of warnings and errors found while parsing a date/time string

Returns
array http://php.net/manual/en/datetime.getlasterrors.php
DateTime::getOffset ( )

Returns the timezone offset

Returns
int http://php.net/manual/en/datetime.getoffset.php

Implements DateTimeInterface.

DateTime::getTimestamp ( )

Gets the Unix timestamp.

Returns
int http://php.net/manual/en/datetime.gettimestamp.php

Implements DateTimeInterface.

DateTime::getTimezone ( )

Get the TimeZone associated with the DateTime

Returns
DateTimeZone http://php.net/manual/en/datetime.gettimezone.php

Implements DateTimeInterface.

DateTime::modify (   $modify)

Alter the timestamp of a DateTime object by incrementing or decrementing in a format accepted by strtotime().

Parameters
string$modifyA date/time string. Valid formats are explained in Date and Time Formats.
Returns
static Returns the DateTime object for method chaining or FALSE on failure. http://php.net/manual/en/datetime.modify.php
DateTime::setDate (   $year,
  $month,
  $day 
)

Sets the current date of the DateTime object to a different date.

Parameters
int$year
int$month
int$day
Returns
static http://php.net/manual/en/datetime.setdate.php
DateTime::setISODate (   $year,
  $week,
  $day = 1 
)

Set a date according to the ISO 8601 standard - using weeks and day offsets rather than specific dates.

Parameters
int$year
int$week
int$day
Returns
static http://php.net/manual/en/datetime.setisodate.php
DateTime::setTime (   $hour,
  $minute,
  $second = 0 
)

Sets the current time of the DateTime object to a different time.

Parameters
int$hour
int$minute
int$second
Returns
static http://php.net/manual/en/datetime.settime.php
DateTime::setTimestamp (   $unixtimestamp)

Sets the date and time based on a Unix timestamp.

Parameters
int$unixtimestamp
Returns
static http://php.net/manual/en/datetime.settimestamp.php
DateTime::setTimezone (   $timezone)

Set the TimeZone associated with the DateTime

Parameters
DateTimeZone$timezone
Returns
static http://php.net/manual/en/datetime.settimezone.php
DateTime::sub ( DateInterval  $interval)

Subtracts an amount of days, months, years, hours, minutes and seconds from a DateTime object

Parameters
DateInterval$interval
Returns
static http://php.net/manual/en/datetime.sub.php

The documentation for this class was generated from the following file: