Table of Contents
XML-RPC for PHP contains some helper functions which you can use to make processing of XML-RPC requests easier.
The XML-RPC specification has this to say on dates:
Don't assume a timezone. It should be specified by the server in its documentation what assumptions it makes about timezones.
Unfortunately, this means that date processing isn't straightforward. Although XML-RPC uses ISO 8601 format dates, it doesn't use the timezone specifier.
We strongly recommend that in every case where you pass dates in XML-RPC calls, you use UTC (GMT) as your timezone. Most computer languages include routines for handling GMT times natively, and you won't have to translate between timezones.
For more information about dates, see ISO 8601: The Right Format for Dates, which has a handy link to a PDF of the ISO 8601 specification. Note that XML-RPC uses exactly one of the available representations: CCYYMMDDTHH:MM:SS.
stringiso8601_encode( | string$time_t, |
int$utc0) ; |
Returns an ISO 8601 formatted date generated from the UNIX
timestamp $time_t
, as returned by the PHP
function time()
.
The argument $utc
can be omitted, in
which case it defaults to 0
. If it is set to
1
, then the function corrects the time passed in
for UTC. Example: if you're in the GMT-6:00 timezone and set
$utc
, you will receive a date representation
six hours ahead of your local time.
The included demo program vardemo.php
includes a demonstration of this function.
intiso8601_decode( | string$isoString, |
int$utc0) ; |
Returns a UNIX timestamp from an ISO 8601 encoded time and date
string passed in. If $utc
is
1
then $isoString
is assumed
to be in the UTC timezone, and thus the result is also UTC: otherwise,
the timezone is assumed to be your local timezone and you receive a
local timestamp.