Sophie

Sophie

distrib > Mandriva > 2008.1 > i586 > by-pkgid > 703d980c580707c382b4e43e25965bc5 > files > 9301

php-manual-pt_BR-5.2.4-1mdv2008.1.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>px_timestamp2string</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REL="HOME"
TITLE="Manual do PHP"
HREF="index.html"><LINK
REL="UP"
TITLE="Paradox File Access"
HREF="ref.paradox.html"><LINK
REL="PREVIOUS"
TITLE="px_set_value"
HREF="function.px-set-value.html"><LINK
REL="NEXT"
TITLE="px_update_record"
HREF="function.px-update-record.html"><META
HTTP-EQUIV="Content-type"
CONTENT="text/html; charset=UTF-8"></HEAD
><BODY
CLASS="refentry"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Manual do PHP</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.px-set-value.html"
ACCESSKEY="P"
>Anterior</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.px-update-record.html"
ACCESSKEY="N"
>Próxima</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="function.px-timestamp2string"
></A
>px_timestamp2string</H1
><DIV
CLASS="refnamediv"
><A
NAME="AEN163393"
></A
><P
>    (PECL)</P
>px_timestamp2string&nbsp;--&nbsp;
   Converts the timestamp into a string.
  </DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN163396"
></A
><H2
>Descrição</H2
>string <B
CLASS="methodname"
>px_timestamp2string</B
> ( resource pxdoc, float value, string format )<BR
></BR
><P
>&#13;   Turns a timestamp as it stored in the paradox file into human readable
   format. Paradox timestamps are the number of milliseconds 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.
  </P
></DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN163411"
></A
><H2
>Parâmetros</H2
><P
>&#13;   <P
></P
><DIV
CLASS="variablelist"
><DL
><DT
><CODE
CLASS="parameter"
>pxdoc</CODE
></DT
><DD
><P
>&#13;       Resource identifier of the paradox database.
      </P
></DD
><DT
><CODE
CLASS="parameter"
>value</CODE
></DT
><DD
><P
>&#13;       Value as stored in paradox database field of type
       PX_FIELD_TIME, or PX_FIELD_TIMESTAMP.
      </P
></DD
><DT
><CODE
CLASS="parameter"
>format</CODE
></DT
><DD
><P
>&#13;        String format similar to the format used by <A
HREF="function.date.html"
><B
CLASS="function"
>date()</B
></A
>.
        The placeholders support by this function is a subset of those
        supported by <A
HREF="function.date.html"
><B
CLASS="function"
>date()</B
></A
> (Y, y, m, n, d, j, H, h, G, g,
        i, s, A, a, L).
      </P
></DD
></DL
></DIV
>
  </P
></DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN163432"
></A
><H2
>Valores de retornado</H2
><P
>&#13;   Retorna <TT
CLASS="constant"
><B
>TRUE</B
></TT
> em caso de sucesso ou <TT
CLASS="constant"
><B
>FALSE</B
></TT
> em falhas.
  </P
></DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN163437"
></A
><H2
>Exemplos</H2
><P
>&#13;   <TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN163440"
></A
><P
><B
>Exemplo 1. Turn a paradox timestamp into a human readable form</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><code><font color="#000000">
<font color="#0000BB">&lt;?php<br />$px </font><font color="#007700">= </font><font color="#0000BB">px_new</font><font color="#007700">();<br /><br /></font><font 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 /></font><font color="#0000BB">$days </font><font color="#007700">= </font><font color="#0000BB">700000</font><font color="#007700">;<br /><br /></font><font color="#FF8000">/* Use the calendar functions to print a */<br />/* human readable format of the date */<br /></font><font color="#007700">echo </font><font color="#0000BB">jdtogregorian</font><font color="#007700">(</font><font color="#0000BB">$days</font><font color="#007700">+</font><font color="#0000BB">1721425</font><font color="#007700">).</font><font color="#DD0000">"\n"</font><font color="#007700">;<br /><br /></font><font color="#FF8000">/* Turn it into a timestamp as it stored in a paradox database */<br />/* Timestamps are stored in milli seconds since 1.1.0000 */<br /></font><font color="#0000BB">$stamp </font><font color="#007700">= </font><font color="#0000BB">$days </font><font color="#007700">* </font><font color="#0000BB">86400.0 </font><font color="#007700">* </font><font color="#0000BB">1000.0</font><font color="#007700">;<br /></font><font color="#FF8000">/* Add one hour */<br /></font><font color="#0000BB">$stamp </font><font color="#007700">+= </font><font color="#0000BB">3600000.0</font><font color="#007700">;<br /></font><font color="#FF8000">/* The following will output '7/15/1917 01:00:00'. */<br /></font><font color="#007700">echo </font><font color="#0000BB">px_timestamp2string</font><font color="#007700">(</font><font color="#0000BB">$px</font><font color="#007700">, </font><font color="#0000BB">$stamp</font><font color="#007700">, </font><font color="#DD0000">"n/d/Y H:i:s"</font><font color="#007700">).</font><font color="#DD0000">"\n"</font><font color="#007700">;<br /><br /></font><font color="#0000BB">px_delete</font><font color="#007700">(</font><font color="#0000BB">$px</font><font color="#007700">);<br /></font><font color="#0000BB">?&gt;</font>
</font>
</code></TD
></TR
></TABLE
><P
>O exemplo acima irá imprimir:</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="screen"
>7/15/1917
7/15/1917 01:00:00</PRE
></TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
>
  </P
><P
>&#13;    The Julian day count as passed to <A
HREF="function.jdtogregorian.html"
><B
CLASS="function"
>jdtogregorian()</B
></A
>
    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 obtain milli seconds.
  </P
></DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN163447"
></A
><H2
>Veja também</H2
><P
>&#13;   <P
></P
><TABLE
BORDER="0"
><TBODY
><TR
><TD
><A
HREF="function.px-date2string.html"
><B
CLASS="function"
>px_date2string()</B
></A
></TD
></TR
><TR
><TD
><A
HREF="function.jdtogregorian.html"
><B
CLASS="function"
>jdtogregorian()</B
></A
></TD
></TR
></TBODY
></TABLE
><P
></P
>
  </P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="function.px-set-value.html"
ACCESSKEY="P"
>Anterior</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Principal</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="function.px-update-record.html"
ACCESSKEY="N"
>Próxima</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>px_set_value</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ref.paradox.html"
ACCESSKEY="U"
>Acima</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>px_update_record</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>