Documentation

DateTimeResult extends DateTime
in package
implements JsonSerializable

DateTime overrides that make DateTime work more seamlessly as a string, with JSON documents, and with JMESPath.

Interfaces, Classes and Traits

JsonSerializable

Table of Contents

__toString()  : string
Serialize the DateTimeResult as an ISO 8601 date string.
fromEpoch()  : DateTimeResult
Create a new DateTimeResult from a unix timestamp.
fromISO8601()  : DateTimeResult
fromTimestamp()  : DateTimeResult
Create a new DateTimeResult from an unknown timestamp.
jsonSerialize()  : mixed|string
Serialize the date as an ISO 8601 date when serializing as JSON.

Methods

__toString()

Serialize the DateTimeResult as an ISO 8601 date string.

public __toString() : string
Return values
string

fromEpoch()

Create a new DateTimeResult from a unix timestamp.

public static fromEpoch( $unixTimestamp) : DateTimeResult

The Unix epoch (or Unix time or POSIX time or Unix timestamp) is the number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT).

Parameters
$unixTimestamp :
Tags
throws
Exception
Return values
DateTimeResult

fromTimestamp()

Create a new DateTimeResult from an unknown timestamp.

public static fromTimestamp( $timestamp[, mixed $expectedFormat = null ]) : DateTimeResult
Parameters
$timestamp :
$expectedFormat : mixed = null
Tags
throws
ParserException|Exception
Return values
DateTimeResult

jsonSerialize()

Serialize the date as an ISO 8601 date when serializing as JSON.

public jsonSerialize() : mixed|string
Return values
mixed|string

Search results