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

Represents a BSON date.

Methods

__construct(Int64|null $milliseconds = null)

Construct a new UTCDateTime

static UTCDateTime
__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

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 UTCDateTime __set_state(array $properties)

No description

Parameters

array $properties

Return Value

UTCDateTime

final DateTime toDateTime()

Returns the DateTime representation of this UTCDateTime

Return Value

DateTime

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

final DateTimeImmutable toDateTimeImmutable()

Since: 1.20.0

Returns the DateTimeImmutable representation of this UTCDateTime

Return Value

DateTimeImmutable

Returns the DateTimeImmutable representation of this UTCDateTimeInterface. The returned DateTime uses the UTC time zone.

final string __toString()

Returns the string representation of this UTCDateTime

Return Value

string

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