mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 08:58:56 +00:00
- initial documentation replacing the template text
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@210407 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
057765cdff
commit
87959ea6a2
1 changed files with 40 additions and 18 deletions
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue