<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >px_date2string</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REL="HOME" TITLE="PHP 手册" HREF="index.html"><LINK REL="UP" TITLE="Paradox File Access" HREF="ref.paradox.html"><LINK REL="PREVIOUS" TITLE="px_create_fp" HREF="function.px-create-fp.html"><LINK REL="NEXT" TITLE="px_delete_record" HREF="function.px-delete-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" >PHP 手册</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="function.px-create-fp.html" ACCESSKEY="P" >上一页</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="function.px-delete-record.html" ACCESSKEY="N" >下一页</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><H1 ><A NAME="function.px-date2string" ></A >px_date2string</H1 ><DIV CLASS="refnamediv" ><A NAME="AEN167334" ></A ><P > (no version information, might be only in CVS)</P >px_date2string -- Converts a date into a string. </DIV ><DIV CLASS="refsect1" ><A NAME="AEN167337" ></A ><H2 >说明</H2 >string <B CLASS="methodname" >px_date2string</B > ( resource pxdoc, int value, string format )<BR ></BR ><P > 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" ><A NAME="AEN167352" ></A ><H2 >参数</H2 ><P > <P ></P ><DIV CLASS="variablelist" ><DL ><DT ><CODE CLASS="parameter" >pxdoc</CODE ></DT ><DD ><P > Resource identifier of the paradox database as returned by <A HREF="function.px-new.html" ><B CLASS="function" >px_new()</B ></A >. </P ></DD ><DT ><CODE CLASS="parameter" >value</CODE ></DT ><DD ><P > Value as stored in paradox database field of type PX_FIELD_DATE. </P ></DD ><DT ><CODE CLASS="parameter" >format</CODE ></DT ><DD ><P > 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, L). </P ></DD ></DL ></DIV > </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN167374" ></A ><H2 >返回值</H2 ><P > 如果成功则返回 <TT CLASS="constant" ><B >TRUE</B ></TT >,失败则返回 <TT CLASS="constant" ><B >FALSE</B ></TT >。 </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN167379" ></A ><H2 >范例</H2 ><P > <TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" CLASS="EXAMPLE" ><TR ><TD ><DIV CLASS="example" ><A NAME="AEN167382" ></A ><P ><B >例 1. Turn a paradox date into a human readable form</B ></P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><code><font color="#000000"> <font color="#0000BB"><?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 /></font><font color="#FF8000">/* px_date2string() outputs the same */<br /></font><font color="#007700">echo </font><font color="#0000BB">px_date2string</font><font color="#007700">(</font><font color="#0000BB">$px</font><font color="#007700">, </font><font color="#0000BB">$days</font><font color="#007700">, </font><font color="#DD0000">"n/d/Y"</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">?></font> </font> </code></TD ></TR ></TABLE ><P >上例将输出:</P ><TABLE BORDER="0" BGCOLOR="#E0E0E0" CELLPADDING="5" ><TR ><TD ><PRE CLASS="screen" >7/15/1917 7/15/1917</PRE ></TD ></TR ></TABLE ></DIV ></TD ></TR ></TABLE > </P ></DIV ><DIV CLASS="refsect1" ><A NAME="AEN167387" ></A ><H2 >参见</H2 ><P > <P ></P ><TABLE BORDER="0" ><TBODY ><TR ><TD ><A HREF="function.px-timestamp2string.html" ><B CLASS="function" >px_timestamp2string()</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-create-fp.html" ACCESSKEY="P" >上一页</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >起始页</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="function.px-delete-record.html" ACCESSKEY="N" >下一页</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >px_create_fp</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="ref.paradox.html" ACCESSKEY="U" >上一级</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >px_delete_record</TD ></TR ></TABLE ></DIV ></BODY ></HTML >