DateTimeResult
extends DateTime
in package
implements
JsonSerializable
DateTime overrides that make DateTime work more seamlessly as a string, with JSON documents, and with JMESPath.
Table of Contents
Interfaces
- JsonSerializable
Methods
- __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() : 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
stringfromEpoch()
Create a new DateTimeResult from a unix timestamp.
public
static fromEpoch(mixed $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 : mixed
Tags
Return values
DateTimeResultfromISO8601()
public
static fromISO8601(mixed $iso8601Timestamp) : DateTimeResult
Parameters
- $iso8601Timestamp : mixed
Return values
DateTimeResultfromTimestamp()
Create a new DateTimeResult from an unknown timestamp.
public
static fromTimestamp(mixed $timestamp[, mixed $expectedFormat = null ]) : DateTimeResult
Parameters
- $timestamp : mixed
- $expectedFormat : mixed = null
Tags
Return values
DateTimeResultjsonSerialize()
Serialize the date as an ISO 8601 date when serializing as JSON.
public
jsonSerialize() : string