git-svn-id: https://192.168.0.254/svn/Proyectos.Incam_SGD/tags/3.7.0.2_original@1 eb19766c-00d9-a042-a3a0-45cb8ec72764
3 lines
5.6 KiB
HTML
3 lines
5.6 KiB
HTML
<html><head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
|
<title>1. 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 9. Helper functions"><link rel="prev" href="ch09.html" title="Chapter 9. Helper functions"><link rel="next" href="ch09s02.html" title="2. 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. Date functions</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch09.html">Prev</a> </td><th width="60%" align="center">Chapter 9. Helper functions</th><td width="20%" align="right"> <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. 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. 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> </td></tr><tr><td> </td><td><var class="pdparam">$utc=0</var><code>)</code>;</td><td> </td></tr></table><table border="0" summary="Function argument synopsis" cellspacing="0" cellpadding="0"><tr><td><code>string</code> </td><td><code><var class="pdparam">$time_t</var>;</code></td></tr><tr><td><code>int</code> </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. 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> </td></tr><tr><td> </td><td><var class="pdparam">$utc=0</var><code>)</code>;</td><td> </td></tr></table><table border="0" summary="Function argument synopsis" cellspacing="0" cellpadding="0"><tr><td><code>string</code> </td><td><code><var class="pdparam">$isoString</var>;</code></td></tr><tr><td><code>int</code> </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> </td><td width="20%" align="center"><a accesskey="u" href="ch09.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch09s02.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 9. Helper functions </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 2. Easy use with nested PHP values</td></tr></table></div></body></html> |