final class Timestamp implements Value (View source)

A PHP representation of the CQL timestamp datatype

Methods

__construct(int $seconds, int $microseconds)

Creates a new timestamp from either unix timestamp and microseconds or from the current time by default.

type()

The type of this timestamp.

int
time()

Unix timestamp.

float|string
microtime(bool $get_as_float)

Microtime from this timestamp

toDateTime()

Converts current timestamp to PHP DateTime.

string
__toString()

Returns a string representation of this timestamp.

Details

__construct(int $seconds, int $microseconds)

Creates a new timestamp from either unix timestamp and microseconds or from the current time by default.

Parameters

int $seconds

The number of seconds

int $microseconds

The number of microseconds

Type type()

The type of this timestamp.

Return Value

Type

int time()

Unix timestamp.

Return Value

int seconds

See also

time

float|string microtime(bool $get_as_float)

Microtime from this timestamp

Parameters

bool $get_as_float

Whether to get this value as float

Return Value

float|string

Float or string representation

See also

microtime

DateTime toDateTime()

Converts current timestamp to PHP DateTime.

Return Value

DateTime

PHP representation

string __toString()

Returns a string representation of this timestamp.

Return Value

string timestamp