PHPXMLRPC 4.11.0

Date
in package

Helps to convert timestamps to the xml-rpc date format.

Feature creep -- add support for custom TZs

Table of Contents

Methods

iso8601Decode()  : int
Given an ISO8601 date string, return a timestamp in the localtime, or UTC.
iso8601Encode()  : string
Given a timestamp, return the corresponding ISO8601 encoded string.

Methods

iso8601Decode()

Given an ISO8601 date string, return a timestamp in the localtime, or UTC.

public static iso8601Decode(string $idate[, bool|int $utc = 0 ]) : int
Parameters
$idate : string
$utc : bool|int = 0

either 0 (assume date is in local time) or 1 (assume date is in UTC)

Return values
int

(timestamp) 0 if the source string does not match the xml-rpc dateTime format

iso8601Encode()

Given a timestamp, return the corresponding ISO8601 encoded string.

public static iso8601Encode(int|DateTimeInterface $timet[, bool|int $utc = 0 ]) : string

Really, timezones ought to be supported but the XML-RPC spec says:

"Don't assume a timezone. It should be specified by the server in its documentation what assumptions it makes about timezones."

This routine always encodes to local time unless $utc is set to 1, in which case UTC output is produced and an adjustment for the local timezone's offset is made

Parameters
$timet : int|DateTimeInterface

timestamp or datetime

$utc : bool|int = 0

(0 or 1)

Return values
string

        
On this page

Search results