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
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
Tags
Return values
DateTimeResult —fromISO8601()
public
static fromISO8601( $iso8601Timestamp) : DateTimeResult
Parameters
Return values
DateTimeResult —fromTimestamp()
Create a new DateTimeResult from an unknown timestamp.
public
static fromTimestamp( $timestamp[, mixed $expectedFormat = null ]) : DateTimeResult
Parameters
Tags
Return values
DateTimeResult —jsonSerialize()
Serialize the date as an ISO 8601 date when serializing as JSON.
public
jsonSerialize() : mixed|string