php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
DateTime Class Reference
Inheritance diagram for DateTime:
DateTimeInterface

Public Member Functions

 __construct (string $datetime="now", ?DateTimeZone $timezone=null)
 
 __serialize ()
 
 __unserialize (array $data)
 
 __wakeup ()
 
 format (string $format)
 
 modify (string $modifier)
 
 add (DateInterval $interval)
 
 sub (DateInterval $interval)
 
 getTimezone ()
 
 setTimezone (DateTimeZone $timezone)
 
 getOffset ()
 
 getMicrosecond ()
 
 setTime (int $hour, int $minute, int $second=0, int $microsecond=0)
 
 setDate (int $year, int $month, int $day)
 
 setISODate (int $year, int $week, int $dayOfWeek=1)
 
 setTimestamp (int $timestamp)
 
 setMicrosecond (int $microsecond)
 
 getTimestamp ()
 
 diff (DateTimeInterface $targetObject, bool $absolute=false)
 

Static Public Member Functions

static __set_state (array $array)
 
static createFromImmutable (DateTimeImmutable $object)
 
static createFromInterface (DateTimeInterface $object)
 
static createFromFormat (string $format, string $datetime, ?DateTimeZone $timezone=null)
 
static createFromTimestamp (int|float $timestamp)
 
static getLastErrors ()
 

Additional Inherited Members

- Data Fields inherited from DateTimeInterface
const string ATOM = DATE_ATOM
 
const string COOKIE = DATE_COOKIE
 
const string ISO8601 = DATE_ISO8601
 
const string ISO8601_EXPANDED = DATE_ISO8601_EXPANDED
 
const string RFC822 = DATE_RFC822
 
const string RFC850 = DATE_RFC850
 
const string RFC1036 = DATE_RFC1036
 
const string RFC1123 = DATE_RFC1123
 
const string RFC7231 = DATE_RFC7231
 
const string RFC2822 = DATE_RFC2822
 
const string RFC3339 = DATE_RFC3339
 
const string RFC3339_EXTENDED = DATE_RFC3339_EXTENDED
 
const string RSS = DATE_RSS
 
const string W3C = DATE_W3C
 

Detailed Description

Definition at line 344 of file php_date.stub.php.

Constructor & Destructor Documentation

◆ __construct()

DateTime::__construct ( string $datetime = "now",
?DateTimeZone $timezone = null )

Definition at line 346 of file php_date.stub.php.

Member Function Documentation

◆ __serialize()

DateTime::__serialize ( )

Implements DateTimeInterface.

Definition at line 348 of file php_date.stub.php.

◆ __set_state()

static DateTime::__set_state ( array $array)
static

@tentative-return-type

Definition at line 356 of file php_date.stub.php.

◆ __unserialize()

DateTime::__unserialize ( array $data)

Implements DateTimeInterface.

Definition at line 350 of file php_date.stub.php.

◆ __wakeup()

DateTime::__wakeup ( )

@tentative-return-type

Implements DateTimeInterface.

Definition at line 353 of file php_date.stub.php.

◆ add()

DateTime::add ( DateInterval $interval)

@tentative-return-type @alias date_add

Definition at line 395 of file php_date.stub.php.

◆ createFromFormat()

static DateTime::createFromFormat ( string $format,
string $datetime,
?DateTimeZone $timezone = null )
static

@tentative-return-type @alias date_create_from_format

Definition at line 368 of file php_date.stub.php.

◆ createFromImmutable()

static DateTime::createFromImmutable ( DateTimeImmutable $object)
static

@tentative-return-type

Definition at line 359 of file php_date.stub.php.

◆ createFromInterface()

static DateTime::createFromInterface ( DateTimeInterface $object)
static
Returns
static

Definition at line 362 of file php_date.stub.php.

◆ createFromTimestamp()

static DateTime::createFromTimestamp ( int|float $timestamp)
static

@tentative-return-type

Definition at line 371 of file php_date.stub.php.

◆ diff()

DateTime::diff ( DateTimeInterface $targetObject,
bool $absolute = false )

@tentative-return-type @alias date_diff

Implements DateTimeInterface.

Definition at line 458 of file php_date.stub.php.

◆ format()

DateTime::format ( string $format)

@tentative-return-type @alias date_format

Implements DateTimeInterface.

Definition at line 384 of file php_date.stub.php.

◆ getLastErrors()

static DateTime::getLastErrors ( )
static
Returns
array<string, int|array>|false @tentative-return-type @alias date_get_last_errors

Definition at line 378 of file php_date.stub.php.

◆ getMicrosecond()

DateTime::getMicrosecond ( )

Implements DateTimeInterface.

Definition at line 420 of file php_date.stub.php.

◆ getOffset()

DateTime::getOffset ( )

@tentative-return-type @alias date_offset_get

Implements DateTimeInterface.

Definition at line 418 of file php_date.stub.php.

◆ getTimestamp()

DateTime::getTimestamp ( )

@tentative-return-type @alias date_timestamp_get

Implements DateTimeInterface.

Definition at line 452 of file php_date.stub.php.

◆ getTimezone()

DateTime::getTimezone ( )

@tentative-return-type @alias date_timezone_get

Implements DateTimeInterface.

Definition at line 406 of file php_date.stub.php.

◆ modify()

DateTime::modify ( string $modifier)

@tentative-return-type

Definition at line 389 of file php_date.stub.php.

◆ setDate()

DateTime::setDate ( int $year,
int $month,
int $day )

@tentative-return-type @alias date_date_set

Definition at line 432 of file php_date.stub.php.

◆ setISODate()

DateTime::setISODate ( int $year,
int $week,
int $dayOfWeek = 1 )

@tentative-return-type @alias date_isodate_set

Definition at line 438 of file php_date.stub.php.

◆ setMicrosecond()

DateTime::setMicrosecond ( int $microsecond)

Definition at line 446 of file php_date.stub.php.

◆ setTime()

DateTime::setTime ( int $hour,
int $minute,
int $second = 0,
int $microsecond = 0 )

@tentative-return-type @alias date_time_set

Definition at line 426 of file php_date.stub.php.

◆ setTimestamp()

DateTime::setTimestamp ( int $timestamp)

@tentative-return-type @alias date_timestamp_set

Definition at line 444 of file php_date.stub.php.

◆ setTimezone()

DateTime::setTimezone ( DateTimeZone $timezone)

@tentative-return-type @alias date_timezone_set

Definition at line 412 of file php_date.stub.php.

◆ sub()

DateTime::sub ( DateInterval $interval)

@tentative-return-type

Definition at line 400 of file php_date.stub.php.


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