steinm Thu Mar 30 15:51:36 2006 UTC
Modified files:
/phpdoc/en/reference/paradox/functions px-timestamp2string.xml
Log:
- initial documentation replacing the template text
http://cvs.php.net/viewcvs.cgi/phpdoc/en/reference/paradox/functions/px-timestamp2string.xml?r1=1.4&r2=1.5&diff_format=u
Index: phpdoc/en/reference/paradox/functions/px-timestamp2string.xml
diff -u phpdoc/en/reference/paradox/functions/px-timestamp2string.xml:1.4
phpdoc/en/reference/paradox/functions/px-timestamp2string.xml:1.5
--- phpdoc/en/reference/paradox/functions/px-timestamp2string.xml:1.4 Fri Feb
10 12:35:39 2006
+++ phpdoc/en/reference/paradox/functions/px-timestamp2string.xml Thu Mar
30 15:51:36 2006
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.4 $ -->
+<!-- $Revision: 1.5 $ -->
<!-- Generated by xml_proto.php v2.2. Found in /scripts directory of phpdoc.
-->
<refentry id="function.px-timestamp2string">
<refnamediv>
@@ -17,7 +17,12 @@
<methodparam><type>string</type><parameter>format</parameter></methodparam>
</methodsynopsis>
- &warn.undocumented.func;
+ <para>
+ Turns a timestamp as it stored in the paradox file into human readable
+ format. Paradox timestamps are the number of milli seconds 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 following example.
+ </para>
</refsect1>
<refsect1 role="parameters">
@@ -97,49 +102,66 @@
-->
- <!-- Use when examples exist
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
- <title>A <function>px_timestamp2string</function> example</title>
- <para>
- Any text that describes the purpose of the example, or
- what goes on in the example should go here (inside the
- <example> tag, not out
- </para>
+ <title>Turn a paradox timestamp into a human readable form</title>
<programlisting role="php">
<![CDATA[
<?php
-if ($anexample === true) {
- echo 'Use the PEAR Coding Standards';
-}
+$px = px_new();
+
+/* make up a date as it could be stored in */
+/* a date field of a paradox db. */
+/* 700000 days since 1.1.0000. */
+$days = 700000;
+
+/* Use the calendar functions to print a */
+/* human readable format of the date */
+echo jdtogregorian($days+1721425)."\n";
+
+/* Turn it into a timestamp as it stored in a paradox database */
+/* Timestamps are stored in milli seconds since 1.1.0000 */
+$stamp = $days * 86400.0 * 1000.0;
+/* Add one hour */
+$stamp += 3600000.0;
+/* The following will output '7/15/1917 01:00:00'. */
+echo px_timestamp2string($px, $stamp, "n/d/Y H:i:s")."\n";
+
+px_delete($px);
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
-Use the PEAR Coding Standards
+7/15/1917
+7/15/1917 01:00:00
]]>
</screen>
</example>
</para>
+
+ <para>
+ The julian day count as passed to <function>jdtogregorian</function>
+ has a different base of 1.1.4714 b.c. and must therefore be calculated
+ by adding 1721425 to the day count used in the paradox file. Turning the
+ day count into a timestamp is easily done by multiplying with 86400000.0
+ to optain milli seconds.
+ </para>
</refsect1>
- -->
- <!-- Use when adding See Also links
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
- <member><function></function></member>
- <member>Or <link linkend="somethingelse">something else</link></member>
+ <member><function>px_date2string</function></member>
+ <member><function>jdtogregorian</function></member>
</simplelist>
</para>
</refsect1>
- -->
</refentry>