FileAccess Orion

Timestamp

Trait Timestamp.

Table of Contents

createFromTimestamp()  : static
Create a Carbon instance from a timestamp.
createFromTimestampMs()  : static
Create a Carbon instance from a timestamp in milliseconds.
createFromTimestampUTC()  : static
Create a Carbon instance from an UTC timestamp.
getPreciseTimestamp()  : float
Returns a timestamp rounded with the given precision (6 by default).
timestamp()  : static
Set the instance's timestamp.
unix()  : int
valueOf()  : float
Returns the milliseconds timestamps used amongst other by Date javascript objects.

Methods

createFromTimestamp()

Create a Carbon instance from a timestamp.

public static createFromTimestamp(int $timestamp[, DateTimeZone|string|null $tz = null ]) : static
Parameters
$timestamp : int
$tz : DateTimeZone|string|null = null
Return values
static

createFromTimestampMs()

Create a Carbon instance from a timestamp in milliseconds.

public static createFromTimestampMs(float $timestamp[, DateTimeZone|string|null $tz = null ]) : static
Parameters
$timestamp : float
$tz : DateTimeZone|string|null = null
Return values
static

createFromTimestampUTC()

Create a Carbon instance from an UTC timestamp.

public static createFromTimestampUTC(int $timestamp) : static
Parameters
$timestamp : int
Return values
static

getPreciseTimestamp()

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

public getPreciseTimestamp([int $precision = 6 ]) : float
Parameters
$precision : int = 6
Tags
example

getPreciseTimestamp() 1532087464437474 (microsecond maximum precision)

example

getPreciseTimestamp(6) 1532087464437474

example

getPreciseTimestamp(5) 153208746443747 (1/100000 second precision)

example

getPreciseTimestamp(4) 15320874644375 (1/10000 second precision)

example

getPreciseTimestamp(3) 1532087464437 (millisecond precision)

example

getPreciseTimestamp(2) 153208746444 (1/100 second precision)

example

getPreciseTimestamp(1) 15320874644 (1/10 second precision)

example

getPreciseTimestamp(0) 1532087464 (second precision)

example

getPreciseTimestamp(-1) 153208746 (10 second precision)

example

getPreciseTimestamp(-2) 15320875 (100 second precision)

Return values
float

timestamp()

Set the instance's timestamp.

public timestamp(int $value) : static
Parameters
$value : int
Return values
static

unix()

public unix() : int
Tags
alias

getTimestamp

Returns the UNIX timestamp for the current date.

Return values
int

valueOf()

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

public valueOf() : float
Return values
float

Search results