SDK for PHP 3.x

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
string

fromEpoch()

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
throws
Exception
Return values
DateTimeResult

fromISO8601()

public static fromISO8601(mixed $iso8601Timestamp) : DateTimeResult
Parameters
$iso8601Timestamp : mixed
Return values
DateTimeResult

fromTimestamp()

Create a new DateTimeResult from an unknown timestamp.

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

jsonSerialize()

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

public jsonSerialize() : string
Return values
string
On this page