final class UTCDateTime implements Type, UTCDateTimeInterface, Serializable, JsonSerializable (View source)

Represents a BSON date.

Methods

__construct(Int64|null $milliseconds = null)

Construct a new UTCDateTime

static 
__set_state(array $properties)

No description

toDateTime()

Returns the DateTime representation of this UTCDateTime

toDateTimeImmutable()

Returns the DateTimeImmutable representation of this UTCDateTime

string
__toString()

Returns the string representation of this UTCDateTime

string|null
serialize()

Serialize a UTCDateTime

void
unserialize(string $data)

Unserialize a UTCDateTime

mixed
jsonSerialize()

Returns a representation that can be converted to JSON

Details

final __construct(Int64|null $milliseconds = null)

Construct a new UTCDateTime

Parameters

Int64|null $milliseconds

static __set_state(array $properties)

No description

Parameters

array $properties

final DateTime toDateTime()

Returns the DateTime representation of this UTCDateTime

Return Value

DateTime

Returns the DateTime representation of this UTCDateTimeInterface. The returned DateTime should use the UTC time zone.

final DateTimeImmutable toDateTimeImmutable()

Since: 1.20.0

Returns the DateTimeImmutable representation of this UTCDateTime

Return Value

DateTimeImmutable

final string __toString()

Returns the string representation of this UTCDateTime

Return Value

string

final string|null serialize()

Since: 1.2.0

Serialize a UTCDateTime

Return Value

string|null

The string representation of the object or null

Exceptions

InvalidArgumentException

final void unserialize(string $data)

Since: 1.2.0

Unserialize a UTCDateTime

Parameters

string $data

The string representation of the object.

Return Value

void

Exceptions

InvalidArgumentException
UnexpectedValueException

final mixed jsonSerialize()

Since: 1.2.0

Returns a representation that can be converted to JSON

Return Value

mixed

data which can be serialized by json_encode, which is a value of any type other than a resource.

Exceptions

InvalidArgumentException