<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Converts a date into a string.</title> </head> <body><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.px-create-fp.html">px_create_fp</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.px-delete-record.html">px_delete_record</a></div> <div class="up"><a href="ref.paradox.html">Paradox Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div><hr /><div id="function.px-date2string" class="refentry"> <div class="refnamediv"> <h1 class="refname">px_date2string</h1> <p class="verinfo">(PECL paradox >= 1.4.0)</p><p class="refpurpose"><span class="refname">px_date2string</span> — <span class="dc-title"> Converts a date into a string. </span></p> </div> <div class="refsect1 description" id="refsect1-function.px-date2string-description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">string</span> <span class="methodname"><strong>px_date2string</strong></span> ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$pxdoc</code></span> , <span class="methodparam"><span class="type">int</span> <code class="parameter">$value</code></span> , <span class="methodparam"><span class="type">string</span> <code class="parameter">$format</code></span> )</div> <p class="para rdfs-comment"> Turns a date as it stored in the paradox file into human readable format. Paradox dates are the number of days since 1.1.0000. This function is just for convenience. It can be easily replaced by some math and the calendar functions as demonstrated in the example below. </p> </div> <div class="refsect1 parameters" id="refsect1-function.px-date2string-parameters"> <h3 class="title">Parameters</h3> <p class="para"> <dl> <dt> <span class="term"><em><code class="parameter">pxdoc</code></em></span> <dd> <p class="para"> Resource identifier of the paradox database as returned by <span class="function"><a href="function.px-new.html" class="function">px_new()</a></span>. </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">value</code></em></span> <dd> <p class="para"> Value as stored in paradox database field of type PX_FIELD_DATE. </p> </dd> </dt> <dt> <span class="term"><em><code class="parameter">format</code></em></span> <dd> <p class="para"> String format similar to the format used by <span class="function"><a href="function.date.html" class="function">date()</a></span>. The placeholders support by this function is a subset of those supported by <span class="function"><a href="function.date.html" class="function">date()</a></span> (Y, y, m, n, d, j, L). </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues" id="refsect1-function.px-date2string-returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns <strong><code>TRUE</code></strong> on success or <strong><code>FALSE</code></strong> on failure. </p> </div> <div class="refsect1 examples" id="refsect1-function.px-date2string-examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example" id="example-2039"> <p><strong>Example #1 Turn a paradox date into a human readable form</strong></p> <div class="example-contents"> <div class="phpcode"><code><span style="color: #000000"> <span style="color: #0000BB"><?php<br />$px </span><span style="color: #007700">= </span><span style="color: #0000BB">px_new</span><span style="color: #007700">();<br /><br /></span><span style="color: #FF8000">/* make up a date as it could be stored in */<br />/* a date field of a paradox db. */<br />/* 700000 days since 1.1.0000. */<br /></span><span style="color: #0000BB">$days </span><span style="color: #007700">= </span><span style="color: #0000BB">700000</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">/* Use the calendar functions to print a */<br />/* human readable format of the date */<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">jdtogregorian</span><span style="color: #007700">(</span><span style="color: #0000BB">$days</span><span style="color: #007700">+</span><span style="color: #0000BB">1721425</span><span style="color: #007700">).</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /></span><span style="color: #FF8000">/* px_date2string() outputs the same */<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">px_date2string</span><span style="color: #007700">(</span><span style="color: #0000BB">$px</span><span style="color: #007700">, </span><span style="color: #0000BB">$days</span><span style="color: #007700">, </span><span style="color: #DD0000">"n/d/Y"</span><span style="color: #007700">).</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">px_delete</span><span style="color: #007700">(</span><span style="color: #0000BB">$px</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?></span> </span> </code></div> </div> <div class="example-contents"><p>The above example will output:</p></div> <div class="example-contents screen"> <div class="cdata"><pre> 7/15/1917 7/15/1917 </pre></div> </div> </div> </p> </div> <div class="refsect1 seealso" id="refsect1-function.px-date2string-seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"> <span class="function"><a href="function.px-timestamp2string.html" class="function" rel="rdfs-seeAlso">px_timestamp2string()</a> - Converts the timestamp into a string.</span></li> <li class="member"> <span class="function"><a href="function.jdtogregorian.html" class="function" rel="rdfs-seeAlso">jdtogregorian()</a> - Converts Julian Day Count to Gregorian date</span></li> </ul> </p> </div> </div><hr /><div class="manualnavbar" style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.px-create-fp.html">px_create_fp</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.px-delete-record.html">px_delete_record</a></div> <div class="up"><a href="ref.paradox.html">Paradox Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div> </div></body></html>