This repository has been archived on 2024-11-28. You can view files and clone it, but cannot push or open issues or pull requests.
Incam_SGD/thirdparty/xmlrpc-2.2/doc/ch09s01.html

3 lines
5.6 KiB
HTML

<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>1.&nbsp;Date functions</title><link rel="stylesheet" href="html.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.71.1"><link rel="start" href="index.html" title="XML-RPC for PHP"><link rel="up" href="ch09.html" title="Chapter&nbsp;9.&nbsp;Helper functions"><link rel="prev" href="ch09.html" title="Chapter&nbsp;9.&nbsp;Helper functions"><link rel="next" href="ch09s02.html" title="2.&nbsp;Easy use with nested PHP values"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">1.&nbsp;Date functions</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch09.html">Prev</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;9.&nbsp;Helper functions</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="ch09s02.html">Next</a></td></tr></table><hr></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e2825"></a>1.&nbsp;Date functions</h2></div></div></div><p>The XML-RPC specification has this to say on dates:</p><div class="blockquote"><blockquote class="blockquote"><p><a name="wrap_xmlrpc_method"></a>Don't assume a timezone. It should be specified by the server in its documentation what assumptions it makes about timezones.</p></blockquote></div><p>Unfortunately, this means that date processing isn't straightforward. Although XML-RPC uses ISO 8601 format dates, it doesn't use the timezone specifier.</p><p>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.</p><p>For more information about dates, see <a href="http://www.uic.edu/year2000/datefmt.html" target="_top">ISO 8601: The Right Format for Dates</a>, 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.</p><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="iso8601encode"></a>1.1.&nbsp;iso8601_encode</h3></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">$isoString = iso8601_encode(</code></td><td><var class="pdparam">$time_t</var>, </td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td><var class="pdparam">$utc=0</var><code>)</code>;</td><td>&nbsp;</td></tr></table><table border="0" summary="Function argument synopsis" cellspacing="0" cellpadding="0"><tr><td><code>string</code>&nbsp;</td><td><code><var class="pdparam">$time_t</var>;</code></td></tr><tr><td><code>int</code>&nbsp;</td><td><code><var class="pdparam">$utc=0</var>;</code></td></tr></table></div><p>Returns an ISO 8601 formatted date generated from the UNIX timestamp <em class="parameter"><code>$time_t</code></em>, as returned by the PHP function <code class="function">time()</code>.</p><p>The argument <em class="parameter"><code>$utc</code></em> can be omitted, in which case it defaults to <code class="literal">0</code>. If it is set to <code class="literal">1</code>, then the function corrects the time passed in for UTC. Example: if you're in the GMT-6:00 timezone and set <em class="parameter"><code>$utc</code></em>, you will receive a date representation six hours ahead of your local time.</p><p>The included demo program <code class="filename">vardemo.php</code> includes a demonstration of this function.</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="iso8601decode"></a>1.2.&nbsp;iso8601_decode</h3></div></div></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0" style="padding-bottom: 1em"><tr><td><code class="funcdef">$time_t = iso8601_decode(</code></td><td><var class="pdparam">$isoString</var>, </td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td><var class="pdparam">$utc=0</var><code>)</code>;</td><td>&nbsp;</td></tr></table><table border="0" summary="Function argument synopsis" cellspacing="0" cellpadding="0"><tr><td><code>string</code>&nbsp;</td><td><code><var class="pdparam">$isoString</var>;</code></td></tr><tr><td><code>int</code>&nbsp;</td><td><code><var class="pdparam">$utc=0</var>;</code></td></tr></table></div><p>Returns a UNIX timestamp from an ISO 8601 encoded time and date string passed in. If <em class="parameter"><code>$utc</code></em> is <code class="literal">1</code> then <em class="parameter"><code>$isoString</code></em> is assumed to be in the UTC timezone, and thus the <em class="parameter"><code>$time_t</code></em> result is also UTC: otherwise, the timezone is assumed to be your local timezone and you receive a local timestamp.</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch09.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="ch09.html">Up</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="ch09s02.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter&nbsp;9.&nbsp;Helper functions&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;2.&nbsp;Easy use with nested PHP values</td></tr></table></div></body></html>