Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
PhpXmlRpc\Helper\Date Class Reference

Static Public Member Functions

static iso8601Decode ($idate, $utc=0)
 Given an ISO8601 date string, return a timestamp in the localtime, or UTC.
 
static iso8601Encode ($timet, $utc=0)
 Given a timestamp, return the corresponding ISO8601 encoded string.
 

Member Function Documentation

◆ iso8601Decode()

static PhpXmlRpc\Helper\Date::iso8601Decode ( $idate,
$utc = 0 )
static

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

Parameters
string$idate
bool | int$utceither 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()

static PhpXmlRpc\Helper\Date::iso8601Encode ( $timet,
$utc = 0 )
static

Given a timestamp, return the corresponding ISO8601 encoded 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
int | DateTimeInterface$timettimestamp or datetime
bool | int$utc(0 or 1)
Return values
string

The documentation for this class was generated from the following file: