trait Timestamp

Trait Timestamp.

Methods

static Timestamp
createFromTimestamp(float|int|string$timestamp,DateTimeZone|string|null$tz =null)

Create a Carbon instance from a timestamp and set the timezone (use default one if not specified).

static Timestamp
createFromTimestampUTC(float|int|string$timestamp)

Create a Carbon instance from an timestamp keeping the timezone to UTC.

static Timestamp
createFromTimestampMsUTC(float|int|string$timestamp)

Create a Carbon instance from a timestamp in milliseconds.

static Timestamp
createFromTimestampMs(float|int|string$timestamp,DateTimeZone|string|null$tz =null)

Create a Carbon instance from a timestamp in milliseconds.

timestamp(float|int|string$unixTimestamp)

Set the instance's timestamp.

float
getPreciseTimestamp(int$precision =6)

Returns a timestamp rounded with the given precision (6 by default).

float
valueOf()

Returns the milliseconds timestamps used amongst other by Date javascript objects.

int
getTimestampMs()

Returns the timestamp with millisecond precision.

int
unix()

No description

Details

at line29
staticTimestamp createFromTimestamp(float|int|string$timestamp,DateTimeZone|string|null$tz =null)

Create a Carbon instance from a timestamp and set the timezone (use default one if not specified).

Timestamp input can be given as int, float or a string containing one or more numbers.

Parameters

float|int|string $timestamp
DateTimeZone|string|null $tz

Return Value

Timestamp

at line43
staticTimestamp createFromTimestampUTC(float|int|string$timestamp)

Create a Carbon instance from an timestamp keeping the timezone to UTC.

Timestamp input can be given as int, float or a string containing one or more numbers.

Parameters

float|int|string $timestamp

Return Value

Timestamp

at line63
staticTimestamp createFromTimestampMsUTC(float|int|string$timestamp)

Create a Carbon instance from a timestamp in milliseconds.

Timestamp input can be given as int, float or a string containing one or more numbers.

Parameters

float|int|string $timestamp

Return Value

Timestamp

at line88
staticTimestamp createFromTimestampMs(float|int|string$timestamp,DateTimeZone|string|null$tz =null)

Create a Carbon instance from a timestamp in milliseconds.

Timestamp input can be given as int, float or a string containing one or more numbers.

Parameters

float|int|string $timestamp
DateTimeZone|string|null $tz

Return Value

Timestamp

at line103
Timestamp timestamp(float|int|string$unixTimestamp)

Set the instance's timestamp.

Timestamp input can be given as int, float or a string containing one or more numbers.

Parameters

float|int|string $unixTimestamp

Return Value

Timestamp

at line126
float getPreciseTimestamp(int$precision =6)

Returns a timestamp rounded with the given precision (6 by default).

Parameters

int $precision

Return Value

float

at line136
float valueOf()

Returns the milliseconds timestamps used amongst other by Date javascript objects.

Return Value

float

at line146
int getTimestampMs()

Returns the timestamp with millisecond precision.

Return Value

int

at line158
int unix()

Return Value

int