cvs: phpdoc-zh /reference/datetime/functions checkdate.xml date.xml getdate.xml gettimeofday.xml gmdate.xml gmmktime.xml gmstrftime.xml localtime.xml
microtime.xml mktime.xml strftime.xml strtotime.xml time.xml
| From: | Dallas Thunder | Date: | Tue, 30 Aug 2005 20:28:19 +0000 |
| Subject: | cvs: phpdoc-zh /reference/datetime/functions checkdate.xml date.xml getdate.xml gettimeofday.xml gmdate.xml gmmktime.xml gmstrftime.xml localtime.xml microtime.xml mktime.xml strftime.xml strtotime.xml time.xml |
||
| Groups: | php.doc.zh | ||
| Request: | Send a blank email to doc-zh+get-2556@lists.php.net to get a copy of this message | ||
dallas Tue Aug 30 16:28:19 2005 EDT
Modified files:
/phpdoc-zh/reference/datetime/functions checkdate.xml date.xml
getdate.xml
gettimeofday.xml gmdate.xml
gmmktime.xml gmstrftime.xml
localtime.xml microtime.xml
mktime.xml strftime.xml
strtotime.xml time.xml
Log:
Updated.
http://cvs.php.net/diff.php/phpdoc-zh/reference/datetime/functions/checkdate.xml?r1=1.2&r2=1.3&ty=u Index: phpdoc-zh/reference/datetime/functions/checkdate.xml diff -u phpdoc-zh/reference/datetime/functions/checkdate.xml:1.2 phpdoc-zh/reference/datetime/functions/checkdate.xml:1.3 --- phpdoc-zh/reference/datetime/functions/checkdate.xml:1.2 Sun Sep 29 23:07:33 2002 +++ phpdoc-zh/reference/datetime/functions/checkdate.xml Tue Aug 30 16:28:19 2005 @@ -1,47 +1,67 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <!-- $Author: dallas $ --> -<!-- EN-Revision: 1.3 Maintainer: dallas Status: ready --> - <refentry id="function.checkdate"> - <refnamediv> - <refname>checkdate</refname> - <refpurpose>ÑéÖ¤Ò»¸ö¸ñÀï¸ßÀïÈÕÆÚ</refpurpose> - </refnamediv> - <refsect1> - <title>˵Ã÷</title> - <methodsynopsis> - <type>bool</type><methodname>checkdate</methodname> - <methodparam><type>int</type><parameter>month</parameter></methodparam> - <methodparam><type>int</type><parameter>day</parameter></methodparam> - <methodparam><type>int</type><parameter>year</parameter></methodparam> - </methodsynopsis> - <para> - Èç¹û¸ø³öµÄÈÕÆÚÓÐЧÔò·µ»Ø &true;£¬·ñÔò·µ»Ø - &false;¡£¼ì²éÓɲÎÊý¹¹³ÉµÄÈÕÆÚµÄºÏ·¨ÐÔ¡£ÈÕÆÚÔÚÒÔÏÂÇé¿öϱ»ÈÏΪÓÐЧ£º - <itemizedlist> - <listitem> - <simpara> - year µÄÖµÊÇ´Ó 1 µ½ 32767 - </simpara> - </listitem> - <listitem> - <simpara> - month µÄÖµÊÇ´Ó 1 µ½ 12 - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>Day</parameter> µÄÖµÔÚ¸ø¶¨µÄ <parameter>month</parameter> - ËùÓ¦¸Ã¾ßÓеÄÌìÊý·¶Î§Ö®ÄÚ£¬ÈòÄêÒѾ¿¼ÂǽøÈ¥ÁË¡£ - </simpara> - </listitem> - </itemizedlist> - </para> - <para> - ²Î¼û <function>mktime</function> ºÍ <function>strtotime</function>¡£ - </para> - </refsect1> - </refentry> +<!-- EN-Revision: 1.7 Maintainer: dallas Status: ready --> +<refentry id="function.checkdate"> + <refnamediv> + <refname>checkdate</refname> + <refpurpose>ÑéÖ¤Ò»¸ö¸ñÀï¸ßÀïÈÕÆÚ</refpurpose> + </refnamediv> + <refsect1> + <title>˵Ã÷</title> + <methodsynopsis> + <type>bool</type><methodname>checkdate</methodname> + <methodparam><type>int</type><parameter>month</parameter></methodparam> + <methodparam><type>int</type><parameter>day</parameter></methodparam> + <methodparam><type>int</type><parameter>year</parameter></methodparam> + </methodsynopsis> + <para> + Èç¹û¸ø³öµÄÈÕÆÚÓÐЧÔò·µ»Ø &true;£¬·ñÔò·µ»Ø + &false;¡£¼ì²éÓɲÎÊý¹¹³ÉµÄÈÕÆÚµÄºÏ·¨ÐÔ¡£ÈÕÆÚÔÚÒÔÏÂÇé¿öϱ»ÈÏΪÓÐЧ£º + <itemizedlist> + <listitem> + <simpara> + year µÄÖµÊÇ´Ó 1 µ½ 32767 + </simpara> + </listitem> + <listitem> + <simpara> + month µÄÖµÊÇ´Ó 1 µ½ 12 + </simpara> + </listitem> + <listitem> + <simpara> + <parameter>Day</parameter> µÄÖµÔÚ¸ø¶¨µÄ <parameter>month</parameter> + ËùÓ¦¸Ã¾ßÓеÄÌìÊý·¶Î§Ö®ÄÚ£¬ÈòÄêÒѾ¿¼ÂǽøÈ¥ÁË¡£ + </simpara> + </listitem> + </itemizedlist> + </para> + <para> + <example> + <title><function>checkdate</function> Àý×Ó</title> + <programlisting role="php"> +<![CDATA[ +<?php +var_dump(checkdate(12, 31, 2000)); +var_dump(checkdate(2, 29, 2001)); +?> +]]> + </programlisting> + &example.outputs; + <screen> +<![CDATA[ +bool(true) +bool(false) +]]> + </screen> + </example> + </para> + <para> + ²Î¼û <function>mktime</function> ºÍ <function>strtotime</function>¡£ + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/diff.php/phpdoc-zh/reference/datetime/functions/date.xml?r1=1.8&r2=1.9&ty=u Index: phpdoc-zh/reference/datetime/functions/date.xml diff -u phpdoc-zh/reference/datetime/functions/date.xml:1.8 phpdoc-zh/reference/datetime/functions/date.xml:1.9 --- phpdoc-zh/reference/datetime/functions/date.xml:1.8 Sun Aug 17 02:34:01 2003 +++ phpdoc-zh/reference/datetime/functions/date.xml Tue Aug 30 16:28:19 2005 @@ -1,282 +1,350 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.8 $ --> +<!-- $Revision: 1.9 $ --> <!-- $Author: dallas $ --> -<!-- EN-Revision: 1.9 Maintainer: dallas Status: ready --> - <refentry id="function.date"> - <refnamediv> - <refname>date</refname> - <refpurpose>¸ñʽ»¯Ò»¸ö±¾µØÊ±¼ä£¯ÈÕÆÚ</refpurpose> - </refnamediv> - <refsect1> - <title>˵Ã÷</title> - <methodsynopsis> - <type>string</type><methodname>date</methodname> - <methodparam><type>string</type><parameter>format</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>timestamp</parameter></methodparam> - </methodsynopsis> - <para> - ·µ»Ø½«ÕûÊý <parameter>timestamp</parameter> - °´ÕÕ¸ø¶¨µÄ¸ñʽ×Ö´®¶ø²úÉúµÄ×Ö·û´®¡£Èç¹ûûÓиø³öʱ¼ä´ÁÔòʹÓñ¾µØµ±Ç°Ê±¼ä¡£»»¾ä»°Ëµ£¬<parameter>timestamp</parameter> - ÊÇ¿ÉÑ¡µÄ£¬Ä¬ÈÏֵΪ <function>time</function>¡£ - <note> - <para> - ÓÐЧµÄʱ¼ä´ÁµäÐÍ·¶Î§ÊǸñÁÖÍþÖÎʱ¼ä 1901 Äê 12 Ô 13 ÈÕ 20:45:54 - µ½ 2038 Äê 1 Ô 19 ÈÕ 03:14:07¡££¨´Ë·¶Î§·ûºÏ 32 - λÓзûºÅÕûÊýµÄ×îСֵºÍ×î´óÖµ£©¡£ÔÚ Windows ϵͳÖд˷¶Î§ÏÞÖÆÎª´Ó 1970 Äê 1 Ô 1 ÈÕµ½ - 2038 Äê 1 Ô 19 ÈÕ¡£ - </para> - </note> - <note> - <para> - Òª½«×Ö·û´®±í´ïµÄʱ¼äת»»³Éʱ¼ä´Á£¬Ó¦¸ÃʹÓà - <function>strtotime</function>¡£´ËÍâһЩÊý¾Ý¿âÓÐһЩº¯Êý½«Æäʱ¼ä¸ñʽת»»³Éʱ¼ä´Á£¨ÀýÈç - MySQL µÄ <ulink url="&url.mysql.docs.date;">UNIX_TIMESTAMP</ulink> º¯Êý£©¡£ - </para> - </note> - </para> - <para> - <table> - <title>¸ñʽ×Ö´®¿ÉÒÔʶ±ðÒÔÏ <parameter>format</parameter> ²ÎÊýµÄ×Ö·û´®</title> - <tgroup cols="3"> - <thead> - <row> - <entry><parameter>format</parameter> ×Ö·û</entry> - <entry>˵Ã÷</entry> - <entry>·µ»ØÖµÀý×Ó</entry> - </row> - </thead> - <tbody> - <row> - <entry><literal>a</literal></entry> - <entry>СдµÄÉÏÎçºÍÏÂÎçÖµ</entry> - <entry><literal>am</literal> »ò <literal>pm</literal></entry> - </row> - <row> - <entry><literal>A</literal></entry> - <entry>´óдµÄÉÏÎçºÍÏÂÎçÖµ</entry> - <entry><literal>AM</literal> »ò <literal>PM</literal></entry> - </row> - <row> - <entry><literal>B</literal></entry> - <entry>Swatch Internet ±ê׼ʱ</entry> - <entry><literal>000</literal> µ½ <literal>999</literal></entry> - </row> - <row> - <entry><literal>d</literal></entry> - <entry>Ô·ÝÖеĵڼ¸Ì죬ÓÐǰµ¼ÁãµÄ 2 λÊý×Ö</entry> - <entry><literal>01</literal> µ½ <literal>31</literal></entry> - </row> - <row> - <entry><literal>D</literal></entry> - <entry>ÐÇÆÚÖеĵڼ¸Ì죬Îı¾±íʾ£¬3 ¸ö×Öĸ</entry> - <entry><literal>Mon</literal> µ½ <literal>Sun</literal></entry> - </row> - <row> - <entry><literal>F</literal></entry> - <entry>Ô·ݣ¬ÍêÕûµÄÎı¾¸ñʽ£¬ÀýÈç January »òÕß March</entry> - <entry><literal>January</literal> µ½ <literal>December</literal></entry> - </row> - <row> - <entry><literal>g</literal></entry> - <entry>Сʱ£¬12 Сʱ¸ñʽ£¬Ã»ÓÐǰµ¼Áã</entry> - <entry><literal>1</literal> µ½ <literal>12</literal></entry> - </row> - <row> - <entry><literal>G</literal></entry> - <entry>Сʱ£¬24 Сʱ¸ñʽ£¬Ã»ÓÐǰµ¼Áã</entry> - <entry><literal>0</literal> µ½ <literal>23</literal></entry> - </row> - <row> - <entry><literal>h</literal></entry> - <entry>Сʱ£¬12 Сʱ¸ñʽ£¬ÓÐǰµ¼Áã</entry> - <entry><literal>01</literal> µ½ <literal>12</literal></entry> - </row> - <row> - <entry><literal>H</literal></entry> - <entry>Сʱ£¬24 Сʱ¸ñʽ£¬ÓÐǰµ¼Áã</entry> - <entry><literal>00</literal> µ½ <literal>23</literal></entry> - </row> - <row> - <entry><literal>i</literal></entry> - <entry>ÓÐǰµ¼ÁãµÄ·ÖÖÓÊý</entry> - <entry><literal>00</literal> µ½ <literal>59</literal>></entry> - </row> - <row> - <entry><literal>I</literal></entry> - <entry>ÊÇ·ñΪÏÄÁîʱ</entry> - <entry>Èç¹ûÊÇÏÄÁîʱΪ <literal>1</literal>£¬·ñÔòΪ <literal>0</literal></entry> - </row> - <row> - <entry><literal>j</literal></entry> - <entry>Ô·ÝÖеĵڼ¸Ì죬ûÓÐǰµ¼Áã</entry> - <entry><literal>1</literal> µ½ <literal>31</literal></entry> - </row> - <row> - <entry><literal>l</literal>£¨¡°L¡±µÄСд×Öĸ£©</entry> - <entry>ÐÇÆÚ¼¸£¬ÍêÕûµÄÎı¾¸ñʽ</entry> - <entry><literal>Sunday</literal> µ½ <literal>Saturday</literal></entry> - </row> - <row> - <entry><literal>L</literal></entry> - <entry>ÊÇ·ñΪÈòÄê</entry> - <entry>Èç¹ûÊÇÈòÄêΪ <literal>1</literal>£¬·ñÔòΪ <literal>0</literal></entry> - </row> - <row> - <entry><literal>m</literal></entry> - <entry>Êý×Ö±íʾµÄÔ·ݣ¬ÓÐǰµ¼Áã</entry> - <entry><literal>01</literal> µ½ <literal>12</literal></entry> - </row> - <row> - <entry><literal>M</literal></entry> - <entry>Èý¸ö×ÖĸËõд±íʾµÄÔ·Ý</entry> - <entry><literal>Jan</literal> µ½ <literal>Dec</literal></entry> - </row> - <row> - <entry><literal>n</literal></entry> - <entry>Êý×Ö±íʾµÄÔ·ݣ¬Ã»ÓÐǰµ¼Áã</entry> - <entry><literal>1</literal> µ½ <literal>12</literal></entry> - </row> - <row> - <entry><literal>O</literal></entry> - <entry>Óë¸ñÁÖÍþÖÎʱ¼äÏà²îµÄСʱÊý</entry> - <entry>ÀýÈ磺<literal>+0200</literal></entry> - </row> - <row> - <entry><literal>r</literal></entry> - <entry>RFC 822 ¸ñʽµÄÈÕÆÚ</entry> - <entry>ÀýÈ磺<literal>Thu, 21 Dec 2000 16:01:07 +0200</literal></entry> - </row> - <row> - <entry><literal>s</literal></entry> - <entry>ÃëÊý£¬ÓÐǰµ¼Áã</entry> - <entry><literal>00</literal> µ½ <literal>59</literal>></entry> - </row> - <row> - <entry><literal>S</literal></entry> - <entry>ÿÔÂÌìÊýºóÃæµÄÓ¢Îĺó׺£¬2 ¸ö×Ö·û</entry> - <entry><literal>st</literal>£¬<literal>nd</literal>£¬<literal>rd</literal> »òÕß <literal>th</literal>¡£¿ÉÒÔºÍ <literal>j</literal> Ò»ÆðÓá£</entry> - </row> - <row> - <entry><literal>t</literal></entry> - <entry>¸ø¶¨Ô·ÝËùÓ¦ÓеÄÌìÊý</entry> - <entry><literal>28</literal> µ½ <literal>31</literal></entry> - </row> - <row> - <entry><literal>T</literal></entry> - <entry>±¾»úËùÔÚµÄÊ±Çø</entry> - <entry>ÀýÈ磺<literal>EST</literal>£¬<literal>MDT</literal>£¨¡¾ÒëÕß×¢¡¿ÔÚ Windows - ÏÂΪÍêÕûÎı¾¸ñʽ£¬ÀýÈç¡°Eastern Standard Time¡±£¬ÖÐÎİæ»áÏÔʾ¡°Öйú±ê׼ʱ¼ä¡±£©¡£</entry> - </row> - <row> - <entry><literal>U</literal></entry> - <entry>´Ó Unix ¼ÍÔª£¨January 1 1970 00:00:00 GMT£©¿ªÊ¼ÖÁ½ñµÄÃëÊý</entry> - <entry>²Î¼û <function>time</function></entry> - </row> - <row> - <entry><literal>w</literal></entry> - <entry>ÐÇÆÚÖеĵڼ¸Ì죬Êý×Ö±íʾ</entry> - <entry><literal>0</literal>£¨±íʾÐÇÆÚÌ죩µ½ <literal>6</literal>£¨±íʾÐÇÆÚÁù£©</entry> - </row> - <row> - <entry><literal>W</literal></entry> - <entry>ISO-8601 ¸ñʽÄê·ÝÖеĵڼ¸ÖÜ£¬Ã¿ÖÜ´ÓÐÇÆÚÒ»¿ªÊ¼£¨PHP 4.1.0 мӵģ©</entry> - <entry>ÀýÈ磺<literal>42</literal>£¨µ±ÄêµÄµÚ 42 ÖÜ£©</entry> - </row> - <row> - <entry><literal>Y</literal></entry> - <entry>4 λÊý×ÖÍêÕû±íʾµÄÄê·Ý</entry> - <entry>ÀýÈ磺<literal>1999</literal> »ò <literal>2003</literal></entry> - </row> - <row> - <entry><literal>y</literal></entry> - <entry>2 λÊý×Ö±íʾµÄÄê·Ý</entry> - <entry>ÀýÈ磺<literal>99</literal> »ò <literal>03</literal></entry> - </row> - <row> - <entry><literal>z</literal></entry> - <entry>Äê·ÝÖеĵڼ¸Ìì</entry> - <entry><literal>0</literal> µ½ <literal>366</literal></entry> - </row> - <row> - <entry><literal>Z</literal></entry> - <entry>ʱ²îÆ«ÒÆÁ¿µÄÃëÊý¡£UTC Î÷±ßµÄÊ±ÇøÆ«ÒÆÁ¿×ÜÊǸºµÄ£¬UTC ¶«±ßµÄÊ±ÇøÆ«ÒÆÁ¿×ÜÊÇÕýµÄ¡£</entry> - <entry><literal>-43200</literal> µ½ <literal>43200</literal></entry> - </row> - </tbody> - </tgroup> - </table> - </para> - <para> - ¸ñʽ×Ö´®Öв»Äܱ»Ê¶±ðµÄ×Ö·û½«ÔÑùÏÔʾ¡£<literal>Z</literal> ¸ñʽÔÚʹÓà <function>gmdate</function> ʱ×ÜÊÇ·µ»Ø <literal>0</literal>¡£ - </para> - <para> - <example> - <title><function>date</function> Àý×Ó</title> - <programlisting role="php"> +<!-- EN-Revision: 1.21 Maintainer: dallas Status: ready --> +<refentry id="function.date"> + <refnamediv> + <refname>date</refname> + <refpurpose>¸ñʽ»¯Ò»¸ö±¾µØÊ±¼ä£¯ÈÕÆÚ</refpurpose> + </refnamediv> + <refsect1> + <title>˵Ã÷</title> + <methodsynopsis> + <type>string</type><methodname>date</methodname> + <methodparam><type>string</type><parameter>format</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>timestamp</parameter></methodparam> + </methodsynopsis> + <para> + ·µ»Ø½«ÕûÊý <parameter>timestamp</parameter> + °´ÕÕ¸ø¶¨µÄ¸ñʽ×Ö´®¶ø²úÉúµÄ×Ö·û´®¡£Èç¹ûûÓиø³öʱ¼ä´ÁÔòʹÓñ¾µØµ±Ç°Ê±¼ä¡£»»¾ä»°Ëµ£¬<parameter>timestamp</parameter> + ÊÇ¿ÉÑ¡µÄ£¬Ä¬ÈÏֵΪ <function>time</function>¡£ + </para> + <tip> + <para> + ×Ô PHP 5.1.0 ÆðÓм¸¸öÓÐÓõÄ<link + linkend="datetime.constants">³£Á¿</link>¿ÉÓÃ×÷±ê×¼µÄÈÕÆÚ£¯Ê±¼ä¸ñʽÀ´Ö¸¶¨ + <parameter>format</parameter> ²ÎÊý¡£ + </para> + </tip> + <note> + <para> + ÓÐЧµÄʱ¼ä´ÁµäÐÍ·¶Î§ÊǸñÁÖÍþÖÎʱ¼ä 1901 Äê 12 Ô 13 ÈÕ 20:45:54 + µ½ 2038 Äê 1 Ô 19 ÈÕ 03:14:07¡££¨´Ë·¶Î§·ûºÏ 32 + λÓзûºÅÕûÊýµÄ×îСֵºÍ×î´óÖµ£©¡£²»¹ýÔÚ PHP 5.1 ֮ǰ´Ë·¶Î§ÔÚijЩϵͳ£¨Èç + Windows£©ÖÐÏÞÖÆÎª´Ó 1970 Äê 1 Ô 1 ÈÕµ½ 2038 Äê 1 Ô 19 ÈÕ¡£ + </para> + </note> + <note> + <para> + Òª½«×Ö·û´®±í´ïµÄʱ¼äת»»³Éʱ¼ä´Á£¬Ó¦¸ÃʹÓà + <function>strtotime</function>¡£´ËÍâһЩÊý¾Ý¿âÓÐһЩº¯Êý½«Æäʱ¼ä¸ñʽת»»³Éʱ¼ä´Á£¨ÀýÈç + MySQL µÄ <ulink url="&url.mysql.docs.date;">UNIX_TIMESTAMP</ulink> º¯Êý£©¡£ + </para> + </note> + <para> + <table> + <title>¸ñʽ×Ö´®¿ÉÒÔʶ±ðÒÔÏ <parameter>format</parameter> ²ÎÊýµÄ×Ö·û´®</title> + <tgroup cols="3"> + <thead> + <row> + <entry><parameter>format</parameter> ×Ö·û</entry> + <entry>˵Ã÷</entry> + <entry>·µ»ØÖµÀý×Ó</entry> + </row> + </thead> + <tbody> + <row> + <entry align="center"><emphasis>ÈÕ</emphasis></entry> + <entry>---</entry> + <entry>---</entry> + </row> + <row> + <entry><literal>d</literal></entry> + <entry>Ô·ÝÖеĵڼ¸Ì죬ÓÐǰµ¼ÁãµÄ 2 λÊý×Ö</entry> + <entry><literal>01</literal> µ½ <literal>31</literal></entry> + </row> + <row> + <entry><literal>D</literal></entry> + <entry>ÐÇÆÚÖеĵڼ¸Ì죬Îı¾±íʾ£¬3 ¸ö×Öĸ</entry> + <entry><literal>Mon</literal> µ½ <literal>Sun</literal></entry> + </row> + <row> + <entry><literal>j</literal></entry> + <entry>Ô·ÝÖеĵڼ¸Ì죬ûÓÐǰµ¼Áã</entry> + <entry><literal>1</literal> µ½ <literal>31</literal></entry> + </row> + <row> + <entry><literal>l</literal>£¨¡°L¡±µÄСд×Öĸ£©</entry> + <entry>ÐÇÆÚ¼¸£¬ÍêÕûµÄÎı¾¸ñʽ</entry> + <entry><literal>Sunday</literal> µ½ <literal>Saturday</literal></entry> + </row> + <row> + <entry><literal>S</literal></entry> + <entry>ÿÔÂÌìÊýºóÃæµÄÓ¢Îĺó׺£¬2 ¸ö×Ö·û</entry> + <entry><literal>st</literal>£¬<literal>nd</literal>£¬<literal>rd</literal> + »òÕß <literal>th</literal>¡£¿ÉÒÔºÍ <literal>j</literal> Ò»ÆðÓÃ</entry> + </row> + <row> + <entry><literal>w</literal></entry> + <entry>ÐÇÆÚÖеĵڼ¸Ì죬Êý×Ö±íʾ</entry> + <entry><literal>0</literal>£¨±íʾÐÇÆÚÌ죩µ½ <literal>6</literal>£¨±íʾÐÇÆÚÁù£©</entry> + </row> + <row> + <entry><literal>z</literal></entry> + <entry>Äê·ÝÖеĵڼ¸Ìì</entry> + <entry><literal>0</literal> µ½ <literal>366</literal></entry> + </row> + <row> + <entry align="center"><emphasis>ÐÇÆÚ</emphasis></entry> + <entry>---</entry> + <entry>---</entry> + </row> + <row> + <entry><literal>W</literal></entry> + <entry>ISO-8601 ¸ñʽÄê·ÝÖеĵڼ¸ÖÜ£¬Ã¿ÖÜ´ÓÐÇÆÚÒ»¿ªÊ¼£¨PHP 4.1.0 мӵģ©</entry> + <entry>ÀýÈ磺<literal>42</literal>£¨µ±ÄêµÄµÚ 42 ÖÜ£©</entry> + </row> + <row> + <entry align="center"><emphasis>ÔÂ</emphasis></entry> + <entry>---</entry> + <entry>---</entry> + </row> + <row> + <entry><literal>F</literal></entry> + <entry>Ô·ݣ¬ÍêÕûµÄÎı¾¸ñʽ£¬ÀýÈç January »òÕß March</entry> + <entry><literal>January</literal> µ½ <literal>December</literal></entry> + </row> + <row> + <entry><literal>m</literal></entry> + <entry>Êý×Ö±íʾµÄÔ·ݣ¬ÓÐǰµ¼Áã</entry> + <entry><literal>01</literal> µ½ <literal>12</literal></entry> + </row> + <row> + <entry><literal>M</literal></entry> + <entry>Èý¸ö×ÖĸËõд±íʾµÄÔ·Ý</entry> + <entry><literal>Jan</literal> µ½ <literal>Dec</literal></entry> + </row> + <row> + <entry><literal>n</literal></entry> + <entry>Êý×Ö±íʾµÄÔ·ݣ¬Ã»ÓÐǰµ¼Áã</entry> + <entry><literal>1</literal> µ½ <literal>12</literal></entry> + </row> + <row> + <entry><literal>t</literal></entry> + <entry>¸ø¶¨Ô·ÝËùÓ¦ÓеÄÌìÊý</entry> + <entry><literal>28</literal> µ½ <literal>31</literal></entry> + </row> + <row> + <entry align="center"><emphasis>Äê</emphasis></entry> + <entry>---</entry> + <entry>---</entry> + </row> + <row> + <entry><literal>L</literal></entry> + <entry>ÊÇ·ñΪÈòÄê</entry> + <entry>Èç¹ûÊÇÈòÄêΪ <literal>1</literal>£¬·ñÔòΪ <literal>0</literal></entry> + </row> + <row> + <entry><literal>o</literal></entry> + <entry>ISO-8601 ¸ñʽÄê·ÝÊý×Ö¡£ÕâºÍ + <literal>Y</literal> µÄÖµÏàͬ£¬Ö»³ýÁËÈç¹û ISO + µÄÐÇÆÚÊý£¨<literal>W</literal>£©ÊôÓÚǰһÄê»òÏÂÒ»Ä꣬ÔòÓÃÄÇÒ»Äê¡££¨PHP 5.1.0 мӣ©</entry> + <entry>Examples: <literal>1999</literal> or <literal>2003</literal></entry> + </row> + <row> + <entry><literal>Y</literal></entry> + <entry>4 λÊý×ÖÍêÕû±íʾµÄÄê·Ý</entry> + <entry>ÀýÈ磺<literal>1999</literal> »ò <literal>2003</literal></entry> + </row> + <row> + <entry><literal>y</literal></entry> + <entry>2 λÊý×Ö±íʾµÄÄê·Ý</entry> + <entry>ÀýÈ磺<literal>99</literal> »ò <literal>03</literal></entry> + </row> + <row> + <entry align="center"><emphasis>ʱ¼ä</emphasis></entry> + <entry>---</entry> + <entry>---</entry> + </row> + <row> + <entry><literal>a</literal></entry> + <entry>СдµÄÉÏÎçºÍÏÂÎçÖµ</entry> + <entry><literal>am</literal> »ò <literal>pm</literal></entry> + </row> + <row> + <entry><literal>A</literal></entry> + <entry>´óдµÄÉÏÎçºÍÏÂÎçÖµ</entry> + <entry><literal>AM</literal> »ò <literal>PM</literal></entry> + </row> + <row> + <entry><literal>B</literal></entry> + <entry>Swatch Internet ±ê׼ʱ</entry> + <entry><literal>000</literal> µ½ <literal>999</literal></entry> + </row> + <row> + <entry><literal>g</literal></entry> + <entry>Сʱ£¬12 Сʱ¸ñʽ£¬Ã»ÓÐǰµ¼Áã</entry> + <entry><literal>1</literal> µ½ <literal>12</literal></entry> + </row> + <row> + <entry><literal>G</literal></entry> + <entry>Сʱ£¬24 Сʱ¸ñʽ£¬Ã»ÓÐǰµ¼Áã</entry> + <entry><literal>0</literal> µ½ <literal>23</literal></entry> + </row> + <row> + <entry><literal>h</literal></entry> + <entry>Сʱ£¬12 Сʱ¸ñʽ£¬ÓÐǰµ¼Áã</entry> + <entry><literal>01</literal> µ½ <literal>12</literal></entry> + </row> + <row> + <entry><literal>H</literal></entry> + <entry>Сʱ£¬24 Сʱ¸ñʽ£¬ÓÐǰµ¼Áã</entry> + <entry><literal>00</literal> µ½ <literal>23</literal></entry> + </row> + <row> + <entry><literal>i</literal></entry> + <entry>ÓÐǰµ¼ÁãµÄ·ÖÖÓÊý</entry> + <entry><literal>00</literal> µ½ <literal>59</literal>></entry> + </row> + <row> + <entry><literal>s</literal></entry> + <entry>ÃëÊý£¬ÓÐǰµ¼Áã</entry> + <entry><literal>00</literal> µ½ <literal>59</literal>></entry> + </row> + <row> + <entry align="center"><emphasis>Ê±Çø</emphasis></entry> + <entry>---</entry> + <entry>---</entry> + </row> + <row> + <entry><literal>e</literal></entry> + <entry>Ê±Çø±êʶ£¨PHP 5.1.0 мӣ©</entry> + <entry>ÀýÈ磺<literal>UTC</literal>£¬<literal>GMT</literal>£¬<literal>Atlantic/Azores</literal></entry> + </row> + <row> + <entry><literal>I</literal></entry> + <entry>ÊÇ·ñΪÏÄÁîʱ</entry> + <entry>Èç¹ûÊÇÏÄÁîʱΪ <literal>1</literal>£¬·ñÔòΪ <literal>0</literal></entry> + </row> + <row> + <entry><literal>O</literal></entry> + <entry>Óë¸ñÁÖÍþÖÎʱ¼äÏà²îµÄСʱÊý</entry> + <entry>ÀýÈ磺<literal>+0200</literal></entry> + </row> + <row> + <entry><literal>T</literal></entry> + <entry>±¾»úËùÔÚµÄÊ±Çø</entry> + <entry>ÀýÈ磺<literal>EST</literal>£¬<literal>MDT</literal>£¨¡¾ÒëÕß×¢¡¿ÔÚ Windows + ÏÂΪÍêÕûÎı¾¸ñʽ£¬ÀýÈç¡°Eastern Standard Time¡±£¬ÖÐÎİæ»áÏÔʾ¡°Öйú±ê׼ʱ¼ä¡±£©¡£</entry> + </row> + <row> + <entry><literal>Z</literal></entry> + <entry>ʱ²îÆ«ÒÆÁ¿µÄÃëÊý¡£UTC Î÷±ßµÄÊ±ÇøÆ«ÒÆÁ¿×ÜÊǸºµÄ£¬UTC ¶«±ßµÄÊ±ÇøÆ«ÒÆÁ¿×ÜÊÇÕýµÄ¡£</entry> + <entry><literal>-43200</literal> µ½ <literal>43200</literal></entry> + </row> + <row> + <entry align="center"><emphasis>ÍêÕûµÄÈÕÆÚ£¯Ê±¼ä</emphasis></entry> + <entry>---</entry> + <entry>---</entry> + </row> + <row> + <entry><literal>c</literal></entry> + <entry>ISO 8601 ¸ñʽµÄÈÕÆÚ£¨PHP 5 мӣ©</entry> + <entry>2004-02-12T15:19:21+00:00</entry> + </row> + <row> + <entry><literal>r</literal></entry> + <entry>RFC 822 ¸ñʽµÄÈÕÆÚ</entry> + <entry>ÀýÈ磺<literal>Thu, 21 Dec 2000 16:01:07 +0200</literal></entry> + </row> + <row> + <entry><literal>U</literal></entry> + <entry>´Ó Unix ¼ÍÔª£¨January 1 1970 00:00:00 GMT£©¿ªÊ¼ÖÁ½ñµÄÃëÊý</entry> + <entry>²Î¼û <function>time</function></entry> + </row> + </tbody> + </tgroup> + </table> + </para> + <para> + ¸ñʽ×Ö´®Öв»Äܱ»Ê¶±ðµÄ×Ö·û½«ÔÑùÏÔʾ¡£<literal>Z</literal> ¸ñʽÔÚʹÓà + <function>gmdate</function> ʱ×ÜÊÇ·µ»Ø <literal>0</literal>¡£ + </para> + <para> + <example> + <title><function>date</function> Àý×Ó</title> + <programlisting role="php"> <![CDATA[ <?php -// Prints something like: Wednesday +// É趨ҪÓõÄĬÈÏÊ±Çø¡£×Ô PHP 5.1 ¿ÉÓà +date_default_timezone_set('UTC'); + + +// Êä³öÀàËÆ£ºMonday echo date("l"); -// Prints something like: Wednesday 15th of January 2003 05:51:38 AM -echo date ("l dS of F Y h:i:s A"); +// Êä³öÀàËÆ£ºMonday 15th of August 2005 03:12:46 PM +echo date('l dS \of F Y h:i:s A'); + +// Êä³ö£ºJuly 1, 2000 is on a Saturday +echo "July 1, 2000 is on a " . date("l", mktime(0, 0, 0, 7, 1, 2000)); + +/* ÔÚ¸ñʽ²ÎÊýÖÐʹÓó£Á¿ */ +// Êä³öÀàËÆ£ºMon, 15 Aug 2005 15:12:46 UTC +echo date(DATE_RFC822); -// Prints: July 1, 2000 is on a Saturday -echo "July 1, 2000 is on a " . date ("l", mktime(0,0,0,7,1,2000)); +// Êä³öÀàËÆ£º2000-07-01T00:00:00+0000 +echo date(DATE_ATOM, mktime(0, 0, 0, 7, 1, 2000)); ?> ]]> - </programlisting> - </example> - </para> - <para> - ÔÚ¸ñʽ×Ö´®ÖеÄ×Ö·ûǰ¼ÓÉÏ·´Ð±ÏßÀ´×ªÒå¿ÉÒÔ±ÜÃâËü±»°´ÕÕÉϱí½âÊÍ¡£Èç¹û¼ÓÉÏ·´Ð±ÏߺóµÄ×Ö·û±¾Éí¾ÍÊÇÒ»¸öÌØÊâÐòÁУ¬ÄÇ»¹Òª×ªÒ巴бÏß¡£ - <example> - <title>ÔÚ <function>date</function> ÖÐתÒå×Ö·û</title> - <programlisting role="php"> + </programlisting> + </example> + </para> + <para> + ÔÚ¸ñʽ×Ö´®ÖеÄ×Ö·ûǰ¼ÓÉÏ·´Ð±ÏßÀ´×ªÒå¿ÉÒÔ±ÜÃâËü±»°´ÕÕÉϱí½âÊÍ¡£Èç¹û¼ÓÉÏ·´Ð±ÏߺóµÄ×Ö·û±¾Éí¾ÍÊÇÒ»¸öÌØÊâÐòÁУ¬ÄÇ»¹Òª×ªÒ巴бÏß¡£ + <example> + <title>ÔÚ <function>date</function> ÖÐתÒå×Ö·û</title> + <programlisting role="php"> <![CDATA[ <?php // prints something like: Wednesday the 15th echo date("l \\t\h\e jS"); ?> ]]> - </programlisting> - </example> - </para> - <para> - ¿ÉÒÔ°Ñ <function>date</function> ºÍ - <function>mktime</function> ½áºÏʹÓÃÀ´µÃµ½Î´À´»ò¹ýÈ¥µÄÈÕÆÚ¡£ - <example> - <title> - <function>date</function> ºÍ <function>mktime</function> Àý×Ó - </title> - <programlisting role="php"> + </programlisting> + </example> + </para> + <para> + ¿ÉÒÔ°Ñ <function>date</function> ºÍ + <function>mktime</function> ½áºÏʹÓÃÀ´µÃµ½Î´À´»ò¹ýÈ¥µÄÈÕÆÚ¡£ + <example> + <title><function>date</function> ºÍ <function>mktime</function> Àý×Ó</title> + <programlisting role="php"> <![CDATA[ <?php -$tomorrow = mktime (0,0,0,date("m") ,date("d")+1,date("Y")); -$lastmonth = mktime (0,0,0,date("m")-1,date("d"), date("Y")); -$nextyear = mktime (0,0,0,date("m"), date("d"), date("Y")+1); +$tomorrow = mktime(0, 0, 0, date("m") , date("d")+1, date("Y")); +$lastmonth = mktime(0, 0, 0, date("m")-1, date("d"), date("Y")); +$nextyear = mktime(0, 0, 0, date("m"), date("d"), date("Y")+1); ?> ]]> - </programlisting> - </example> - <note> - <para> - ÓÉÓÚÏÄÁîʱµÄÔµ¹Ê£¬ÕâÖÖ·½·¨±È¼òµ¥µØÔÚʱ¼ä´ÁÉϼӼõÒ»Ìì»òÕßÒ»¸öÔµÄÃëÊý¸ü¿É¿¿¡£ - </para> - </note> - </para> + </programlisting> + </example> + <note> <para> - һЩʹÓà <function>date</function> - ¸ñʽ»¯ÈÕÆÚµÄÀý×Ó¡£×¢ÒâҪתÒåËùÓÐÆäËüµÄ×Ö·û£¬ÒòΪĿǰÓÐÌØÊ⺬ÒåµÄ×Ö·û»á²úÉú²»ÐèÒªµÄ½á¹û£¬¶øÆäÓà×Ö·ûÔÚ - PHP ½«À´µÄ°æ±¾ÖпÉÄܻᱻÓÃÉÏ¡£µ±×ªÒåʱ£¬×¢ÒâÓõ¥ÒýºÅÒÔ±ÜÃâÀàËÆ \n µÄ×Ö·û±ä³ÉÁË»»Ðзû¡£ - <example> - <title> - <function>date</function> Formatting - </title> - <programlisting role="php"> + ÓÉÓÚÏÄÁîʱµÄÔµ¹Ê£¬ÕâÖÖ·½·¨±È¼òµ¥µØÔÚʱ¼ä´ÁÉϼӼõÒ»Ìì»òÕßÒ»¸öÔµÄÃëÊý¸ü¿É¿¿¡£ + </para> + </note> + </para> + <para> + һЩʹÓà <function>date</function> + ¸ñʽ»¯ÈÕÆÚµÄÀý×Ó¡£×¢ÒâҪתÒåËùÓÐÆäËüµÄ×Ö·û£¬ÒòΪĿǰÓÐÌØÊ⺬ÒåµÄ×Ö·û»á²úÉú²»ÐèÒªµÄ½á¹û£¬¶øÆäÓà×Ö·ûÔÚ + PHP ½«À´µÄ°æ±¾ÖпÉÄܻᱻÓÃÉÏ¡£µ±×ªÒåʱ£¬×¢ÒâÓõ¥ÒýºÅÒÔ±ÜÃâÀàËÆ \n µÄ×Ö·û±ä³ÉÁË»»Ðзû¡£ + <example> + <title><function>date</function> ¸ñʽ¾ÙÀý</title> + <programlisting role="php"> <![CDATA[ <?php -// Assuming today is: March 10th, 2001, 5:16:18 pm +// ¼Ù¶¨½ñÌìÊÇ£ºMarch 10th, 2001, 5:16:18 pm $today = date("F j, Y, g:i a"); // March 10, 2001, 5:16 pm $today = date("m.d.y"); // 03.10.01 $today = date("j, n, Y"); // 10, 3, 2001 @@ -288,18 +356,19 @@ $today = date("H:i:s"); // 17:16:17 ?> ]]> - </programlisting> - </example> - </para> - <para> - Òª¸ñʽ»¯ÆäËüÓïÖÖµÄÈÕÆÚ£¬Ó¦¸ÃÓà <function>setlocale</function> ºÍ - <function>strftime</function> º¯Êý¡£ - </para> - <para> - ²Î¼û <function>getlastmod</function>£¬<function>gmdate</function>£¬<function>mktime</function>£¬<function>strftime</function> ºÍ <function>time</function>¡£ - </para> - </refsect1> - </refentry> + </programlisting> + </example> + </para> + <para> + Òª¸ñʽ»¯ÆäËüÓïÖÖµÄÈÕÆÚ£¬Ó¦¸ÃÓà <function>setlocale</function> ºÍ + <function>strftime</function> º¯Êý¡£ + </para> + <para> + ²Î¼û <function>getlastmod</function>£¬<function>gmdate</function>£¬<function>mktime</function>£¬<function>strftime</function> + ºÍ <function>time</function>¡£ + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/diff.php/phpdoc-zh/reference/datetime/functions/getdate.xml?r1=1.4&r2=1.5&ty=u Index: phpdoc-zh/reference/datetime/functions/getdate.xml diff -u phpdoc-zh/reference/datetime/functions/getdate.xml:1.4 phpdoc-zh/reference/datetime/functions/getdate.xml:1.5 --- phpdoc-zh/reference/datetime/functions/getdate.xml:1.4 Sun Aug 17 02:34:01 2003 +++ phpdoc-zh/reference/datetime/functions/getdate.xml Tue Aug 30 16:28:19 2005 @@ -1,116 +1,112 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <!-- $Author: dallas $ --> -<!-- EN-Revision: 1.8 Maintainer: dallas Status: ready --> - <refentry id="function.getdate"> - <refnamediv> - <refname>getdate</refname> - <refpurpose>È¡µÃÈÕÆÚ£¯Ê±¼äÐÅÏ¢</refpurpose> - </refnamediv> - <refsect1> - <title>˵Ã÷</title> - <methodsynopsis> - <type>array</type><methodname>getdate</methodname> - <methodparam choice="opt"><type>int</type><parameter>timestamp</parameter></methodparam> - </methodsynopsis> - <para> - ·µ»ØÒ»¸ö¸ù¾Ý <parameter>timestamp</parameter> - µÃ³öµÄ°üº¬ÓÐÈÕÆÚÐÅÏ¢µÄ½áºÏÊý×é¡£Èç¹ûûÓиø³öʱ¼ä´ÁÔòÈÏΪÊǵ±Ç°±¾µØÊ±¼ä¡£Êý×éÖеĵ¥ÔªÈçÏ£º - </para> - <para> - <table> - <title>·µ»ØµÄ¹ØÁªÊý×éÖеļüÃûµ¥Ôª</title> - <tgroup cols="3"> - <thead> - <row> - <entry>¼üÃû</entry> - <entry>˵Ã÷</entry> - <entry>·µ»ØÖµÀý×Ó</entry> - </row> - </thead> - <tbody> - <row> - <entry><literal>"seconds"</literal></entry> - <entry>ÃëµÄÊý×Ö±íʾ</entry> - <entry><literal>0</literal> µ½ <literal>59</literal></entry> - </row> - <row> - <entry><literal>"minutes"</literal></entry> - <entry>·ÖÖÓµÄÊý×Ö±íʾ</entry> - <entry><literal>0</literal> µ½ <literal>59</literal></entry> - </row> - <row> - <entry><literal>"hours"</literal></entry> - <entry>СʱµÄÊý×Ö±íʾ</entry> - <entry><literal>0</literal> µ½ <literal>23</literal></entry> - </row> - <row> - <entry><literal>"mday"</literal></entry> - <entry>Ô·ÝÖеڼ¸ÌìµÄÊý×Ö±íʾ</entry> - <entry><literal>1</literal> µ½ <literal>31</literal></entry> - </row> - <row> - <entry><literal>"wday"</literal></entry> - <entry>ÐÇÆÚÖеڼ¸ÌìµÄÊý×Ö±íʾ</entry> - <entry><literal>0</literal>£¨±íʾÐÇÆÚÌ죩µ½ <literal>6</literal>£¨±íʾÐÇÆÚÁù£©</entry> - </row> - <row> - <entry><literal>"mon"</literal></entry> - <entry>Ô·ݵÄÊý×Ö±íʾ</entry> - <entry><literal>1</literal> µ½ <literal>12</literal></entry> - </row> - <row> - <entry><literal>"year"</literal></entry> - <entry>4 λÊý×Ö±íʾµÄÍêÕûÄê·Ý</entry> - <entry>ÀýÈ磺<literal>1999</literal> »ò <literal>2003</literal></entry> - </row> - <row> - <entry><literal>"yday"</literal></entry> - <entry>Ò»ÄêÖеڼ¸ÌìµÄÊý×Ö±íʾ</entry> - <entry><literal>0</literal> µ½ <literal>366</literal></entry> - </row> - <row> - <entry><literal>"weekday"</literal></entry> - <entry>ÐÇÆÚ¼¸µÄÍêÕûÎı¾±íʾ</entry> - <entry><literal>Sunday</literal> µ½ <literal>Saturday</literal></entry> - </row> - <row> - <entry><literal>"month"</literal></entry> - <entry>Ô·ݵÄÍêÕûÎı¾±íʾ</entry> - <entry><literal>January></literal> µ½ <literal>December</literal></entry> - </row> - <row> - <entry><literal>0</literal></entry> - <entry> - ×Ô´Ó Unix ¼ÍÔª¿ªÊ¼ÖÁ½ñµÄÃëÊý£¬ºÍ <function>time</function> - µÄ·µ»ØÖµÒÔ¼°ÓÃÓÚ <function>date</function> µÄÖµÀàËÆ¡£ - </entry> - <entry> - ϵͳÏà¹Ø£¬µäÐÍֵΪ´Ó <literal>-2147483648</literal> µ½ - <literal>2147483647</literal>¡£ - </entry> - </row> - </tbody> - </tgroup> - </table> - </para> - <para> - <example> - <title> - <function>getdate</function> Àý×Ó - </title> - <programlisting role="php"> +<!-- EN-Revision: 1.11 Maintainer: dallas Status: ready --> +<refentry id="function.getdate"> + <refnamediv> + <refname>getdate</refname> + <refpurpose>È¡µÃÈÕÆÚ£¯Ê±¼äÐÅÏ¢</refpurpose> + </refnamediv> + <refsect1> + <title>˵Ã÷</title> + <methodsynopsis> + <type>array</type><methodname>getdate</methodname> + <methodparam choice="opt"><type>int</type><parameter>timestamp</parameter></methodparam> + </methodsynopsis> + <para> + ·µ»ØÒ»¸ö¸ù¾Ý <parameter>timestamp</parameter> + µÃ³öµÄ°üº¬ÓÐÈÕÆÚÐÅÏ¢µÄ½áºÏÊý×é¡£Èç¹ûûÓиø³öʱ¼ä´ÁÔòÈÏΪÊǵ±Ç°±¾µØÊ±¼ä¡£Êý×éÖеĵ¥ÔªÈçÏ£º + </para> + <para> + <table> + <title>·µ»ØµÄ¹ØÁªÊý×éÖеļüÃûµ¥Ôª</title> + <tgroup cols="3"> + <thead> + <row> + <entry>¼üÃû</entry> + <entry>˵Ã÷</entry> + <entry>·µ»ØÖµÀý×Ó</entry> + </row> + </thead> + <tbody> + <row> + <entry><literal>"seconds"</literal></entry> + <entry>ÃëµÄÊý×Ö±íʾ</entry> + <entry><literal>0</literal> µ½ <literal>59</literal></entry> + </row> + <row> + <entry><literal>"minutes"</literal></entry> + <entry>·ÖÖÓµÄÊý×Ö±íʾ</entry> + <entry><literal>0</literal> µ½ <literal>59</literal></entry> + </row> + <row> + <entry><literal>"hours"</literal></entry> + <entry>СʱµÄÊý×Ö±íʾ</entry> + <entry><literal>0</literal> µ½ <literal>23</literal></entry> + </row> + <row> + <entry><literal>"mday"</literal></entry> + <entry>Ô·ÝÖеڼ¸ÌìµÄÊý×Ö±íʾ</entry> + <entry><literal>1</literal> µ½ <literal>31</literal></entry> + </row> + <row> + <entry><literal>"wday"</literal></entry> + <entry>ÐÇÆÚÖеڼ¸ÌìµÄÊý×Ö±íʾ</entry> + <entry><literal>0</literal>£¨±íʾÐÇÆÚÌ죩µ½ <literal>6</literal>£¨±íʾÐÇÆÚÁù£©</entry> + </row> + <row> + <entry><literal>"mon"</literal></entry> + <entry>Ô·ݵÄÊý×Ö±íʾ</entry> + <entry><literal>1</literal> µ½ <literal>12</literal></entry> + </row> + <row> + <entry><literal>"year"</literal></entry> + <entry>4 λÊý×Ö±íʾµÄÍêÕûÄê·Ý</entry> + <entry>ÀýÈ磺<literal>1999</literal> »ò <literal>2003</literal></entry> + </row> + <row> + <entry><literal>"yday"</literal></entry> + <entry>Ò»ÄêÖеڼ¸ÌìµÄÊý×Ö±íʾ</entry> + <entry><literal>0</literal> µ½ <literal>365</literal></entry> + </row> + <row> + <entry><literal>"weekday"</literal></entry> + <entry>ÐÇÆÚ¼¸µÄÍêÕûÎı¾±íʾ</entry> + <entry><literal>Sunday</literal> µ½ <literal>Saturday</literal></entry> + </row> + <row> + <entry><literal>"month"</literal></entry> + <entry>Ô·ݵÄÍêÕûÎı¾±íʾ</entry> + <entry><literal>January></literal> µ½ <literal>December</literal></entry> + </row> + <row> + <entry><literal>0</literal></entry> + <entry> + ×Ô´Ó Unix ¼ÍÔª¿ªÊ¼ÖÁ½ñµÄÃëÊý£¬ºÍ <function>time</function> + µÄ·µ»ØÖµÒÔ¼°ÓÃÓÚ <function>date</function> µÄÖµÀàËÆ¡£ + </entry> + <entry> + ϵͳÏà¹Ø£¬µäÐÍֵΪ´Ó <literal>-2147483648</literal> µ½ + <literal>2147483647</literal>¡£ + </entry> + </row> + </tbody> + </tgroup> + </table> + </para> + <para> + <example> + <title><function>getdate</function> Àý×Ó</title> + <programlisting role="php"> <![CDATA[ <?php $today = getdate(); print_r($today); ?> ]]> - </programlisting> - <para> - Êä³öÀàËÆÓÚ£º - </para> - <screen> + </programlisting> + &example.outputs.similar; + <screen> <![CDATA[ Array ( @@ -127,15 +123,15 @@ [0] => 1055901520 ) ]]> - </screen> - </example> - </para> - <para> - ²Î¼û <function>date</function>£¬<function>time</function> - ºÍ <function>setlocale</function>¡£ - </para> - </refsect1> - </refentry> + </screen> + </example> + </para> + <para> + ²Î¼û <function>date</function>£¬<function>time</function> + ºÍ <function>setlocale</function>¡£ + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/diff.php/phpdoc-zh/reference/datetime/functions/gettimeofday.xml?r1=1.2&r2=1.3&ty=u Index: phpdoc-zh/reference/datetime/functions/gettimeofday.xml diff -u phpdoc-zh/reference/datetime/functions/gettimeofday.xml:1.2 phpdoc-zh/reference/datetime/functions/gettimeofday.xml:1.3 --- phpdoc-zh/reference/datetime/functions/gettimeofday.xml:1.2 Sun Sep 29 23:07:33 2002 +++ phpdoc-zh/reference/datetime/functions/gettimeofday.xml Tue Aug 30 16:28:19 2005 @@ -1,45 +1,82 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <!-- $Author: dallas $ --> -<!-- EN-Revision: 1.2 Maintainer: dallas Status: ready --> - <refentry id="function.gettimeofday"> - <refnamediv> - <refname>gettimeofday</refname> - <refpurpose>È¡µÃµ±Ç°Ê±¼ä</refpurpose> - </refnamediv> - <refsect1> - <title>˵Ã÷</title> - <methodsynopsis> - <type>array</type><methodname>gettimeofday</methodname> - <void/> - </methodsynopsis> - <para> - ±¾º¯ÊýÊÇ gettimeofday(2) µÄ½Ó¿Ú¡£·µ»ØÒ»¸ö½áºÏÊý×飬°üº¬ÓÐϵͳµ÷Ó÷µ»ØµÄÊý¾Ý¡£ - <itemizedlist> - <listitem> - <simpara> - "sec" - ÃëÊý - </simpara> - </listitem> - <listitem> - <simpara> - "usec" - ΢ÃëÊý - </simpara> - </listitem> - <listitem> - <simpara> - "minuteswest" - ¸ñÁÖÍþÖÎÏòÎ÷µÄ·ÖÖÓÊý - </simpara> - </listitem> - <listitem> - <simpara> - "dsttime" - ÏÄÁîʱÐÞÕýµÄÀàÐÍ - </simpara> - </listitem> - </itemizedlist> - </para> - </refsect1> - </refentry> +<!-- EN-Revision: 1.6 Maintainer: dallas Status: ready --> +<refentry id="function.gettimeofday"> + <refnamediv> + <refname>gettimeofday</refname> + <refpurpose>È¡µÃµ±Ç°Ê±¼ä</refpurpose> + </refnamediv> + <refsect1> + <title>˵Ã÷</title> + <methodsynopsis> + <type>mixed</type><methodname>gettimeofday</methodname> + <methodparam choice="opt"><type>bool</type><parameter>return_float</parameter></methodparam> + </methodsynopsis> + <para> + ±¾º¯ÊýÊÇ gettimeofday(2) µÄ½Ó¿Ú¡£·µ»ØÒ»¸ö¹ØÁªÊý×飬°üº¬ÓÐϵͳµ÷Ó÷µ»ØµÄÊý¾Ý¡£ + </para> + <para> + ×Ô PHP 5.1.0 ÆðÓиö¿ÉÑ¡²ÎÊý + <parameter>return_float</parameter>£¬µ±ÆäÉèΪ + &true; ʱ£¬<function>gettimeofday</function> + »á·µ»ØÒ»¸ö¸¡µãÊý¡£ + </para> + <para> + Êý×éÖеļüΪ£º + <itemizedlist> + <listitem> + <simpara> + "sec" - ×Ô Unix ¼ÍÔªÆðµÄÃëÊý + </simpara> + </listitem> + <listitem> + <simpara> + "usec" - ΢ÃëÊý + </simpara> + </listitem> + <listitem> + <simpara> + "minuteswest" - ¸ñÁÖÍþÖÎÏòÎ÷µÄ·ÖÖÓÊý + </simpara> + </listitem> + <listitem> + <simpara> + "dsttime" - ÏÄÁîʱÐÞÕýµÄÀàÐÍ + </simpara> + </listitem> + </itemizedlist> + </para> + <para> + <example> + <title><function>gettimeofday</function> example</title> + <programlisting role="php"> +<![CDATA[ +<?php +print_r(gettimeofday()); + +echo gettimeofday(true); +?> +]]> + </programlisting> + &example.outputs.similar; + <screen> +<![CDATA[ +Array +( + [sec] => 1073504408 + [usec] => 238215 + [minuteswest] => 0 + [dsttime] => 1 +) + +1073504408.23910 +]]> + </screen> + </example> + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/diff.php/phpdoc-zh/reference/datetime/functions/gmdate.xml?r1=1.6&r2=1.7&ty=u Index: phpdoc-zh/reference/datetime/functions/gmdate.xml diff -u phpdoc-zh/reference/datetime/functions/gmdate.xml:1.6 phpdoc-zh/reference/datetime/functions/gmdate.xml:1.7 --- phpdoc-zh/reference/datetime/functions/gmdate.xml:1.6 Mon May 12 01:23:49 2003 +++ phpdoc-zh/reference/datetime/functions/gmdate.xml Tue Aug 30 16:28:19 2005 @@ -1,59 +1,48 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.6 $ --> +<!-- $Revision: 1.7 $ --> <!-- $Author: dallas $ --> -<!-- EN-Revision: 1.7 Maintainer: dallas Status: ready --> - <refentry id="function.gmdate"> - <refnamediv> - <refname>gmdate</refname> - <refpurpose>¸ñʽ»¯Ò»¸ö GMT/UTC ÈÕÆÚ£¯Ê±¼ä</refpurpose> - </refnamediv> - <refsect1> - <title>˵Ã÷</title> - <methodsynopsis> - <type>string</type><methodname>gmdate</methodname> - <methodparam><type>string</type><parameter>format</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>timestamp</parameter></methodparam> - </methodsynopsis> - <para> - ͬ <function>date</function> - º¯ÊýÍêȫһÑù£¬Ö»³ýÁË·µ»ØµÄʱ¼äÊǸñÁÖÍþÖαê׼ʱ£¨GMT£©¡£ÀýÈçµ±ÔÚÖйú£¨GMT - +0800£©ÔËÐÐÒÔϳÌÐòʱ£¬µÚÒ»ÐÐÏÔʾ¡°Jan 01 2000 00:00:00¡±¶øµÚ¶þÐÐÏÔʾ¡°Dec - 31 1999 16:00:00¡±¡£ - <example> - <title><function>gmdate</function> Àý×Ó</title> - <programlisting role="php"> +<!-- EN-Revision: 1.10 Maintainer: dallas Status: ready --> +<refentry id="function.gmdate"> + <refnamediv> + <refname>gmdate</refname> + <refpurpose>¸ñʽ»¯Ò»¸ö GMT/UTC ÈÕÆÚ£¯Ê±¼ä</refpurpose> + </refnamediv> + <refsect1> + <title>˵Ã÷</title> + <methodsynopsis> + <type>string</type><methodname>gmdate</methodname> + <methodparam><type>string</type><parameter>format</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>timestamp</parameter></methodparam> + </methodsynopsis> + <para> + ͬ <function>date</function> + º¯ÊýÍêȫһÑù£¬Ö»³ýÁË·µ»ØµÄʱ¼äÊǸñÁÖÍþÖαê׼ʱ£¨GMT£©¡£ÀýÈçµ±ÔÚÖйú£¨GMT + +0800£©ÔËÐÐÒÔϳÌÐòʱ£¬µÚÒ»ÐÐÏÔʾ¡°Jan 01 2000 00:00:00¡±¶øµÚ¶þÐÐÏÔʾ¡°Dec + 31 1999 16:00:00¡±¡£ + <example> + <title><function>gmdate</function> Àý×Ó</title> + <programlisting role="php"> <![CDATA[ <?php -echo date ("M d Y H:i:s", mktime (0,0,0,1,1,2000)); -echo gmdate ("M d Y H:i:s", mktime (0,0,0,1,1,2000)); +echo date("M d Y H:i:s", mktime (0,0,0,1,1,2000)); +echo gmdate("M d Y H:i:s", mktime (0,0,0,1,1,2000)); ?> ]]> - </programlisting> - </example> - </para> - <note> - <para> - ÔÚ Microsoft Windows - ϵÁеIJÙ×÷ϵͳÖÐʵÏÖ±¾º¯ÊýµÄϵͳ¿âÊÇ»µµÄ£¬Òò´Ë - <function>gmdate</function> ²»Ö§³Ö¸ºµÄ - <parameter>timestamp</parameter> ²ÎÊýÖµ¡£Ï¸½Ú¼û´íÎ󱨸棺<ulink - url="&url.php.bugs;22620">#22620</ulink>£¬<ulink - url="&url.php.bugs;22457">#22457</ulink> ºÍ <ulink - url="&url.php.bugs;14391">#14391</ulink>¡£ - </para> - <para> - ´ËÎÊÌâ²»»á³öÏÖÓÚ Unix/Linux - ²Ù×÷ϵͳ£¬¸ÃϵͳϵÄϵͳ¿â»á°´ÕÕÔ¤ÆÚ½á¹ûÔË×÷¡£ - </para> - <para> - PHP ÎÞ·¨ÐÞ¸´»µµÄϵͳ¿â¡£ÒªÐÞÕýÓë´ËÀàËÆµÄÎÊÌâÇëÁªÏµ²Ù×÷ϵͳ¹©Ó¦ÉÌ¡£ - </para> - </note> - <para> - ²Î¼û <function>date</function>£¬<function>mktime</function>£¬<function>gmmktime</function> ºÍ <function>strftime</function>¡£ - </para> - </refsect1> - </refentry> + </programlisting> + </example> + </para> + <note> + <para> + ÔÚ PHP 5.1.0 ֮ǰ£¬¸ºµÄʱ¼ä´Á£¨1970 Äê֮ǰµÄÈÕÆÚ£©ÔÚijЩϵͳÏ£¨ÀýÈç + Windows£©²»Äܹ¤×÷¡£ + </para> + </note> + <para> + ²Î¼û <function>date</function>£¬<function>mktime</function>£¬<function>gmmktime</function> + ºÍ <function>strftime</function>¡£ + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/diff.php/phpdoc-zh/reference/datetime/functions/gmmktime.xml?r1=1.4&r2=1.5&ty=u Index: phpdoc-zh/reference/datetime/functions/gmmktime.xml diff -u phpdoc-zh/reference/datetime/functions/gmmktime.xml:1.4 phpdoc-zh/reference/datetime/functions/gmmktime.xml:1.5 --- phpdoc-zh/reference/datetime/functions/gmmktime.xml:1.4 Sun Apr 20 02:22:53 2003 +++ phpdoc-zh/reference/datetime/functions/gmmktime.xml Tue Aug 30 16:28:19 2005 @@ -1,33 +1,65 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <!-- $Author: dallas $ --> -<!-- EN-Revision: 1.3 Maintainer: dallas Status: ready --> - <refentry id="function.gmmktime"> - <refnamediv> - <refname>gmmktime</refname> - <refpurpose>È¡µÃ GMT ÈÕÆÚµÄ UNIX ʱ¼ä´Á</refpurpose> - </refnamediv> - <refsect1> - <title>˵Ã÷</title> - <methodsynopsis> - <type>int</type><methodname>gmmktime</methodname> - <methodparam choice="opt"><type>int</type><parameter>hour</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>minute</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>second</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>month</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>day</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>year</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>is_dst</parameter></methodparam> - </methodsynopsis> - <para> - ºÍ <function>mktime</function> ÍêȫһÑù£¬Ö»³ýÁË·µ»ØÖµÊǸñÁÖÍþÖαê׼ʱµÄʱ¼ä´Á¡£ - </para> - <para> - ºÍ <function>mktime</function> - Ò»Ñù£¬²ÎÊý¿ÉÒÔ´ÓÓÒµ½×óÒÀ´Î¿Õ×Å£¬¿Õ×ŵIJÎÊý»á±»ÉèΪÏàÓ¦µÄµ±Ç° GMT Öµ¡£ - </para> - </refsect1> - </refentry> +<!-- EN-Revision: 1.9 Maintainer: dallas Status: ready --> +<refentry id="function.gmmktime"> + <refnamediv> + <refname>gmmktime</refname> + <refpurpose>È¡µÃ GMT ÈÕÆÚµÄ UNIX ʱ¼ä´Á</refpurpose> + </refnamediv> + <refsect1> + <title>˵Ã÷</title> + <methodsynopsis> + <type>int</type><methodname>gmmktime</methodname> + <methodparam choice="opt"><type>int</type><parameter>hour</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>minute</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>second</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>month</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>day</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>year</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>is_dst</parameter></methodparam> + </methodsynopsis> + <para> + ºÍ <function>mktime</function> ÍêȫһÑù£¬Ö»³ýÁË·µ»ØÖµÊǸñÁÖÍþÖαê׼ʱµÄʱ¼ä´Á¡£ + </para> + <para> + ²ÎÊý×ÜÊDZíʾ GMT ÈÕÆÚ£¬Òò´Ë <parameter>is_dst</parameter> + ¶Ô½á¹ûûÓÐÓ°Ïì¡£ + </para> + <para> + ºÍ <function>mktime</function> + Ò»Ñù£¬²ÎÊý¿ÉÒÔ´ÓÓÒµ½×óÒÀ´Î¿Õ×Å£¬¿Õ×ŵIJÎÊý»á±»ÉèΪÏàÓ¦µÄµ±Ç° GMT Öµ¡£ + </para> + <note> + <para> + ×Ô 5.1.0 Æð£¬<parameter>is_dst</parameter> ²ÎÊý±»·ÏÆú¡£Òò´ËÓ¦¸ÃÓÃеÄÊ±Çø´¦ÀíÌØÐÔ¡£ + </para> + </note> + <para> + <note> + <simpara> + <function>gmmktime</function> ÄÚ²¿Ê¹ÓÃÁË + <function>mktime</function>£¬Òò´ËÖ»ÓÐת»»³É±¾µØÊ±¼äÒ²ºÏ·¨µÄʱ¼ä²ÅÄÜÓÃÔÚÆäÖС£ + so only times valid in derived local time can be used. + </simpara> + </note> + <example> + <title><function>gmmktime</function> ÔÚ Windows Öеı߽ç</title> + <programlisting role="php"> +<![CDATA[ +<?php +gmmktime(0, 0, 0, 1, 1, 1970); // ÔÚ GMT ºÍÎ÷·½ºÏ·¨£¬ÔÚ¶«·½²»ºÏ·¨ +?> +]]> + </programlisting> + </example> + </para> + <para> + ²Î¼û <function>mktime</function>£¬<function>date</function> + ºÍ <function>time</function>¡£ + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/diff.php/phpdoc-zh/reference/datetime/functions/gmstrftime.xml?r1=1.4&r2=1.5&ty=u Index: phpdoc-zh/reference/datetime/functions/gmstrftime.xml diff -u phpdoc-zh/reference/datetime/functions/gmstrftime.xml:1.4 phpdoc-zh/reference/datetime/functions/gmstrftime.xml:1.5 --- phpdoc-zh/reference/datetime/functions/gmstrftime.xml:1.4 Sun Apr 20 02:22:53 2003 +++ phpdoc-zh/reference/datetime/functions/gmstrftime.xml Tue Aug 30 16:28:19 2005 @@ -1,44 +1,44 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <!-- $Author: dallas $ --> -<!-- EN-Revision: 1.5 Maintainer: dallas Status: ready --> - <refentry id="function.gmstrftime"> - <refnamediv> - <refname>gmstrftime</refname> - <refpurpose> - ¸ù¾ÝÇøÓòÉèÖøñʽ»¯ GMT/UTC ʱ¼ä£¯ÈÕÆÚ - </refpurpose> - </refnamediv> - <refsect1> - <title>˵Ã÷</title> - <methodsynopsis> - <type>string</type><methodname>gmstrftime</methodname> - <methodparam><type>string</type><parameter>format</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>timestamp</parameter></methodparam> - </methodsynopsis> - <para> - ºÍ <function>strftime</function> - µÄÐÐΪÏàͬ£¬Ö»³ýÁË·µ»ØÊ±¼äÊǸñÁÖÍþÖαê׼ʱ£¨GMT£©¡£ÀýÈ磬µ±ÔÚ¶«²¿±ê׼ʱ£¨EST£¬GMT - -500£©ÔËÐÐʱ£¬ÏÂÃæµÚÒ»ÐÐÏÔʾ¡°Dec 31 1998 20:00:00¡±£¬¶øµÚ¶þÐÐÏÔʾ¡°Jan 01 1999 - 01:00:00¡±¡£ - <example> - <title><function>gmstrftime</function> Àý×Ó</title> - <programlisting role="php"> +<!-- EN-Revision: 1.8 Maintainer: dallas Status: ready --> +<refentry id="function.gmstrftime"> + <refnamediv> + <refname>gmstrftime</refname> + <refpurpose> + ¸ù¾ÝÇøÓòÉèÖøñʽ»¯ GMT/UTC ʱ¼ä£¯ÈÕÆÚ + </refpurpose> + </refnamediv> + <refsect1> + <title>˵Ã÷</title> + <methodsynopsis> + <type>string</type><methodname>gmstrftime</methodname> + <methodparam><type>string</type><parameter>format</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>timestamp</parameter></methodparam> + </methodsynopsis> + <para> + ºÍ <function>strftime</function> + µÄÐÐΪÏàͬ£¬Ö»³ýÁË·µ»ØÊ±¼äÊǸñÁÖÍþÖαê׼ʱ£¨GMT£©¡£ÀýÈ磬µ±ÔÚ¶«²¿±ê׼ʱ£¨EST£¬GMT + -500£©ÔËÐÐʱ£¬ÏÂÃæµÚÒ»ÐÐÏÔʾ¡°Dec 31 1998 20:00:00¡±£¬¶øµÚ¶þÐÐÏÔʾ¡°Jan 01 1999 + 01:00:00¡±¡£ + <example> + <title><function>gmstrftime</function> Àý×Ó</title> + <programlisting role="php"> <![CDATA[ <?php -setlocale (LC_TIME, 'en_US'); -echo strftime ("%b %d %Y %H:%M:%S", mktime (20,0,0,12,31,98))."\n"; -echo gmstrftime ("%b %d %Y %H:%M:%S", mktime (20,0,0,12,31,98))."\n"; +setlocale(LC_TIME, 'en_US'); +echo strftime("%b %d %Y %H:%M:%S", mktime (20,0,0,12,31,98))."\n"; +echo gmstrftime("%b %d %Y %H:%M:%S", mktime (20,0,0,12,31,98))."\n"; ?> ]]> - </programlisting> - </example> - </para> - <para> - ²Î¼û <function>strftime</function>¡£ - </para> - </refsect1> - </refentry> + </programlisting> + </example> + </para> + <para> + ²Î¼û <function>strftime</function>¡£ + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/diff.php/phpdoc-zh/reference/datetime/functions/localtime.xml?r1=1.3&r2=1.4&ty=u Index: phpdoc-zh/reference/datetime/functions/localtime.xml diff -u phpdoc-zh/reference/datetime/functions/localtime.xml:1.3 phpdoc-zh/reference/datetime/functions/localtime.xml:1.4 --- phpdoc-zh/reference/datetime/functions/localtime.xml:1.3 Sun Apr 20 02:22:53 2003 +++ phpdoc-zh/reference/datetime/functions/localtime.xml Tue Aug 30 16:28:19 2005 @@ -1,82 +1,128 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.3 $ --> +<!-- $Revision: 1.4 $ --> <!-- $Author: dallas $ --> -<!-- EN-Revision: 1.3 Maintainer: dallas Status: ready --> - <refentry id="function.localtime"> - <refnamediv> - <refname>localtime</refname> - <refpurpose>È¡µÃ±¾µØÊ±¼ä</refpurpose> - </refnamediv> - <refsect1> - <title>˵Ã÷</title> - <methodsynopsis> - <type>array</type><methodname>localtime</methodname> - <methodparam choice="opt"><type>int</type><parameter> - timestamp - </parameter></methodparam> - <methodparam choice="opt"><type>bool</type><parameter> - is_associative - </parameter></methodparam> - </methodsynopsis> - <para> - <function>localtime</function> º¯Êý·µ»ØÒ»¸öÊý×飬Æä½á¹¹ºÍ - C º¯Êýµ÷Ó÷µ»ØµÄÍêȫһÑù¡£<function>localtime</function> - µÄµÚÒ»¸ö²ÎÊýÊÇʱ¼ä´Á£¬Èç¹ûûÓиø³öÔòʹÓÃ´Ó - <function>time</function> ·µ»ØµÄµ±Ç°Ê±¼ä¡£µÚ¶þ¸ö²ÎÊýÊÇ - <parameter>is_associative</parameter>£¬Èç¹ûÉèΪ 0 - »òδÌṩÔò·µ»ØµÄÊÇÆÕͨµÄÊý×ÖË÷ÒýÊý×é¡£Èç¹û¸Ã²ÎÊýÉèΪ 1 Ôò - <function>localtime</function> º¯Êý·µ»Ø°üº¬ÓÐËùÓÐ´Ó - C µÄ localtime º¯Êýµ÷ÓÃËù·µ»ØµÄ²»Í¬µ¥ÔªµÄ½áºÏÊý×é¡£½áºÏÊý×éÖв»Í¬µÄ¼üÃûΪ£º - <itemizedlist> - <listitem> - <simpara> - "tm_sec" - ÃëÊý - </simpara> - </listitem> - <listitem> - <simpara> - "tm_min" - ·ÖÖÓÊý - </simpara> - </listitem> - <listitem> - <simpara> - "tm_hour" - Сʱ - </simpara> - </listitem> - <listitem> - <simpara> - "tm_mday" - Ô·ÝÖеĵڼ¸ÈÕ - </simpara> - </listitem> - <listitem> - <simpara> - "tm_mon" - Äê·ÝÖеĵڼ¸¸öÔ£¬´Ó 0 ¿ªÊ¼±íʾһÔ - </simpara> - </listitem> - <listitem> - <simpara> - "tm_year" - Äê·Ý£¬´Ó 1900 ¿ªÊ¼ - </simpara> - </listitem> - <listitem> - <simpara> - "tm_wday" - ÐÇÆÚÖеĵڼ¸Ìì - </simpara> - </listitem> - <listitem> - <simpara> - "tm_yday" - Ò»ÄêÖеĵڼ¸Ìì - </simpara> - </listitem> - <listitem> - <simpara> - "tm_isdst" - ÏÄÁîʱµ±Ç°ÊÇ·ñÉúЧ - </simpara> - </listitem> - </itemizedlist> - </para> - </refsect1> - </refentry> +<!-- EN-Revision: 1.7 Maintainer: dallas Status: ready --> +<refentry id="function.localtime"> + <refnamediv> + <refname>localtime</refname> + <refpurpose>È¡µÃ±¾µØÊ±¼ä</refpurpose> + </refnamediv> + <refsect1> + <title>˵Ã÷</title> + <methodsynopsis> + <type>array</type><methodname>localtime</methodname> + <methodparam choice="opt"><type>int</type><parameter>timestamp</parameter></methodparam> + <methodparam choice="opt"><type>bool</type><parameter>is_associative</parameter></methodparam> + </methodsynopsis> + <para> + <function>localtime</function> º¯Êý·µ»ØÒ»¸öÊý×飬Æä½á¹¹ºÍ + C º¯Êýµ÷Ó÷µ»ØµÄÍêȫһÑù¡£<function>localtime</function> + µÄµÚÒ»¸ö²ÎÊýÊÇʱ¼ä´Á£¬Èç¹ûûÓиø³öÔòʹÓÃ´Ó + <function>time</function> ·µ»ØµÄµ±Ç°Ê±¼ä¡£µÚ¶þ¸ö²ÎÊýÊÇ + <parameter>is_associative</parameter>£¬Èç¹ûÉèΪ &false; + »òδÌṩÔò·µ»ØµÄÊÇÆÕͨµÄÊý×ÖË÷ÒýÊý×é¡£Èç¹û¸Ã²ÎÊýÉèΪ &true; Ôò + <function>localtime</function> º¯Êý·µ»Ø°üº¬ÓÐËùÓÐ´Ó + C µÄ localtime º¯Êýµ÷ÓÃËù·µ»ØµÄ²»Í¬µ¥ÔªµÄ¹ØÁªÊý×é¡£¹ØÁªÊý×éÖв»Í¬µÄ¼üÃûΪ£º + <itemizedlist> + <listitem> + <simpara> + "tm_sec" - ÃëÊý + </simpara> + </listitem> + <listitem> + <simpara> + "tm_min" - ·ÖÖÓÊý + </simpara> + </listitem> + <listitem> + <simpara> + "tm_hour" - Сʱ + </simpara> + </listitem> + <listitem> + <simpara> + "tm_mday" - Ô·ÝÖеĵڼ¸ÈÕ + </simpara> + </listitem> + <listitem> + <simpara> + "tm_mon" - Äê·ÝÖеĵڼ¸¸öÔ£¬´Ó 0 ¿ªÊ¼±íʾһÔ + </simpara> + </listitem> + <listitem> + <simpara> + "tm_year" - Äê·Ý£¬´Ó 1900 ¿ªÊ¼ + </simpara> + </listitem> + <listitem> + <simpara> + "tm_wday" - ÐÇÆÚÖеĵڼ¸Ìì + </simpara> + </listitem> + <listitem> + <simpara> + "tm_yday" - Ò»ÄêÖеĵڼ¸Ìì + </simpara> + </listitem> + <listitem> + <simpara> + "tm_isdst" - ÏÄÁîʱµ±Ç°ÊÇ·ñÉúЧ + </simpara> + </listitem> + </itemizedlist> + </para> + <note> + <simpara> + ÔÂ·Ý´Ó 0£¨Ò»Ô£©µ½ 11£¨Ê®¶þÔ£©£¬ÐÇÆÚÊý´Ó 0£¨ÐÇÆÚÌ죩µ½ 6£¨ÐÇÆÚÁù£©¡£ + </simpara> + </note> + <para> + <example> + <title><function>time</function> Àý×Ó</title> + <programlisting role="php"> +<![CDATA[ +<?php +$localtime = localtime(); +$localtime_assoc = localtime(time(), true); +print_r($localtime); +print_r($localtime_assoc); +?> +]]> + </programlisting> + &example.outputs.similar; + <screen> +<![CDATA[ +Array +( + [0] => 24 + [1] => 3 + [2] => 19 + [3] => 3 + [4] => 3 + [5] => 105 + [6] => 0 + [7] => 92 + [9] => 1 +) + +Array +( + [tm_sec] => 24 + [tm_min] => 3 + [tm_hour] => 19 + [tm_mday] => 3 + [tm_mon] => 3 + [tm_year] => 105 + [tm_wday] => 0 + [tm_yday] => 92 + [tm_isdst] => 1 +) +]]> + </screen> + </example> + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/diff.php/phpdoc-zh/reference/datetime/functions/microtime.xml?r1=1.3&r2=1.4&ty=u Index: phpdoc-zh/reference/datetime/functions/microtime.xml diff -u phpdoc-zh/reference/datetime/functions/microtime.xml:1.3 phpdoc-zh/reference/datetime/functions/microtime.xml:1.4 --- phpdoc-zh/reference/datetime/functions/microtime.xml:1.3 Sun Apr 20 02:22:53 2003 +++ phpdoc-zh/reference/datetime/functions/microtime.xml Tue Aug 30 16:28:19 2005 @@ -1,56 +1,71 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.3 $ --> +<!-- $Revision: 1.4 $ --> <!-- $Author: dallas $ --> -<!-- EN-Revision: 1.3 Maintainer: dallas Status: ready --> - <refentry id="function.microtime"> - <refnamediv> - <refname>microtime</refname> - <refpurpose> - ·µ»Øµ±Ç° UNIX ʱ¼ä´ÁºÍ΢ÃëÊý</refpurpose> - </refnamediv> - <refsect1> - <title>˵Ã÷</title> - <methodsynopsis> - <type>string</type><methodname>microtime</methodname> - <void/> - </methodsynopsis> - <para> - ·µ»Ø¸ñʽΪ¡°msec sec¡±µÄ×Ö·û´®£¬ÆäÖÐ sec Êǵ±Ç°µÄ Unix - ʱ¼ä´Á£¬msec ÊÇ΢Ã벿·Ö¡£±¾º¯Êý½öÔÚÖ§³Ö gettimeofday() - ϵͳµ÷ÓõIJÙ×÷ϵͳÏ¿ÉÓᣠ- </para> - <para> - ×Ö·û´®µÄÁ½²¿·Ö¶¼ÊÇÒÔÃëΪµ¥Î»·µ»ØµÄ¡£ - <example> - <title><function>microtime</function> Àý×Ó</title> - <programlisting role="php"> +<!-- EN-Revision: 1.13 Maintainer: dallas Status: ready --> +<refentry id="function.microtime"> + <refnamediv> + <refname>microtime</refname> + <refpurpose>·µ»Øµ±Ç° Unix ʱ¼ä´ÁºÍ΢ÃëÊý</refpurpose> + </refnamediv> + <refsect1> + <title>˵Ã÷</title> + <methodsynopsis> + <type>mixed</type><methodname>microtime</methodname> + <methodparam choice="opt"><type>bool</type><parameter>get_as_float</parameter></methodparam> + </methodsynopsis> + <para> + <function>microtime</function> µ±Ç° Unix + ʱ¼ä´ÁÒÔ¼°Î¢ÃëÊý¡£±¾º¯Êý½öÔÚÖ§³Ö gettimeofday() + ϵͳµ÷ÓõIJÙ×÷ϵͳÏ¿ÉÓᣠ+ </para> + <para> + Èç¹ûµ÷ÓÃʱ²»´ø¿ÉÑ¡²ÎÊý£¬±¾º¯ÊýÒÔ "msec sec" + µÄ¸ñʽ·µ»ØÒ»¸ö×Ö·û´®£¬ÆäÖÐ sec ÊÇ×Ô Unix ¼ÍÔª£¨0:00:00 January 1, + 1970 GMT£©Æðµ½ÏÖÔÚµÄÃëÊý£¬msec ÊÇ΢Ã벿·Ö¡£×Ö·û´®µÄÁ½²¿·Ö¶¼ÊÇÒÔÃëΪµ¥Î»·µ»ØµÄ¡£ + </para> + <para> + Èç¹û¸ø³öÁË <parameter>get_as_float</parameter> ²ÎÊý²¢ÇÒÆäÖµµÈ¼ÛÓÚ + &true;£¬<function>microtime</function> ½«·µ»ØÒ»¸ö¸¡µãÊý¡£ + </para> + <note> + <simpara> + <parameter>get_as_float</parameter> ²ÎÊýÊÇ PHP 5.0.0 мӵġ£ + </simpara> + </note> + <para> + <example> + <title>Óà <function>microtime</function> ¶Ô½Å±¾µÄÔËÐмÆÊ±</title> + <programlisting role="php"> <![CDATA[ <?php -function getmicrotime(){ - list($usec, $sec) = explode(" ",microtime()); - return ((float)$usec + (float)$sec); - } +/** + * Simple function to replicate PHP 5 behaviour + */ +function microtime_float() +{ + list($usec, $sec) = explode(" ", microtime()); + return ((float)$usec + (float)$sec); +} -$time_start = getmicrotime(); - -for ($i=0; $i < 1000; $i++){ - //do nothing, 1000 times - } +$time_start = microtime_float(); -$time_end = getmicrotime(); +// Sleep for a while +usleep(100); + +$time_end = microtime_float(); $time = $time_end - $time_start; -echo "Did nothing in $time seconds"; +echo "Did nothing in $time seconds\n"; ?> ]]> - </programlisting> - </example> - </para> - <para> - ²Î¼û <function>time</function>¡£ - </para> - </refsect1> - </refentry> + </programlisting> + </example> + </para> + <para> + ²Î¼û <function>time</function>¡£ + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/diff.php/phpdoc-zh/reference/datetime/functions/mktime.xml?r1=1.4&r2=1.5&ty=u Index: phpdoc-zh/reference/datetime/functions/mktime.xml diff -u phpdoc-zh/reference/datetime/functions/mktime.xml:1.4 phpdoc-zh/reference/datetime/functions/mktime.xml:1.5 --- phpdoc-zh/reference/datetime/functions/mktime.xml:1.4 Sun Apr 20 02:22:53 2003 +++ phpdoc-zh/reference/datetime/functions/mktime.xml Tue Aug 30 16:28:19 2005 @@ -1,108 +1,221 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <!-- $Author: dallas $ --> -<!-- EN-Revision: 1.5 Maintainer: dallas Status: ready --> - <refentry id="function.mktime"> - <refnamediv> - <refname>mktime</refname> - <refpurpose>È¡µÃÒ»¸öÈÕÆÚµÄ UNIX ʱ¼ä´Á</refpurpose> - </refnamediv> - <refsect1> - <title>˵Ã÷</title> - <methodsynopsis> - <type>int</type><methodname>mktime</methodname> - <methodparam choice="opt"><type>int</type><parameter>hour</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>minute</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>second</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>month</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>day</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>year</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>is_dst</parameter></methodparam> - </methodsynopsis> - <para> - <emphasis>¾¯¸æ£º</emphasis>×¢Òâ²ÎÊýµÄÆæ¹Ö˳Ðò£¬ÕâºÍ±ê×¼µÄ UNIX mktime() - µ÷ÓÃÖеIJÎÊý˳Ðò²»Í¬¡£Ôڽű¾¾³£»á»ìÏýÕâЩֵ¶ø³ö´í¡£ - <!-- ²»Ì«ºÃ·£¬ÔÎÄÁô×Å¡£ - Note the strange order of - arguments, which differs from the order of arguments in a regular - UNIX mktime() call and which does not lend itself well to leaving - out parameters from right to left (see below). It is a common - error to mix these values up in a script. - --> - </para> - <para> - ¸ù¾Ý¸ø³öµÄ²ÎÊý·µ»Ø Unix ʱ¼ä´Á¡£Ê±¼ä´ÁÊÇÒ»¸ö³¤ÕûÊý£¬°üº¬ÁË´Ó - Unix мÍÔª£¨1970 Äê 1 Ô 1 ÈÕ£©µ½¸ø¶¨Ê±¼äµÄÃëÊý¡£ - </para> - <para> - ²ÎÊý¿ÉÒÔ´ÓÓÒÏò×óÊ¡ÂÔ£¬ÈκÎÊ¡ÂԵIJÎÊý»á±»ÉèÖóɱ¾µØÈÕÆÚºÍʱ¼äµÄµ±Ç°Öµ¡£ - </para> - <para> - <parameter>is_dst</parameter> ÔÚÏÄÁîʱ¿ÉÒÔ±»ÉèΪ 1£¬Èç¹û²»ÊÇÔòÉèΪ - 0£¬»òÕß²»ÖªµÀÊÇ·ñΪÏÄÁîʱµÄ»°ÉèΪ -1£¨Ä¬ÈÏÖµ£©¡£Èç¹û²»ÖªµÀ£¬PHP - »á³¢ÊÔ×Ô¼ºÅжϡ£Õâ¿ÉÄÜ»á²úÉúδԤÆÚ£¨µ«²»ÊÇ´íÎ󣩵Ľá¹û¡£ +<!-- EN-Revision: 1.20 Maintainer: dallas Status: ready --> +<refentry id="function.mktime"> + <refnamediv> + <refname>mktime</refname> + <refpurpose>È¡µÃÒ»¸öÈÕÆÚµÄ Unix ʱ¼ä´Á</refpurpose> + </refnamediv> + + <refsect1 role="description"> + &reftitle.description; + <methodsynopsis> + <type>int</type><methodname>mktime</methodname> + <methodparam choice="opt"><type>int</type><parameter>hour</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>minute</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>second</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>month</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>day</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>year</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>is_dst</parameter></methodparam> + </methodsynopsis> + <para> + ¸ù¾Ý¸ø³öµÄ²ÎÊý·µ»Ø Unix ʱ¼ä´Á¡£Ê±¼ä´ÁÊÇÒ»¸ö³¤ÕûÊý£¬°üº¬ÁË´Ó + Unix ¼ÍÔª£¨January 1 1970 00:00:00 GMT£©µ½¸ø¶¨Ê±¼äµÄÃëÊý¡£ + </para> + <para> + ²ÎÊý¿ÉÒÔ´ÓÓÒÏò×óÊ¡ÂÔ£¬ÈκÎÊ¡ÂԵIJÎÊý»á±»ÉèÖóɱ¾µØÈÕÆÚºÍʱ¼äµÄµ±Ç°Öµ¡£ + </para> + </para> + </refsect1> + + <refsect1 role="parameters"> + &reftitle.parameters; + <para> + <variablelist> + <varlistentry> + <term><parameter>hour</parameter></term> + <listitem> + <para> + СʱÊý¡£ + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>minute</parameter></term> + <listitem> + <para> + ·ÖÖÓÊý¡£ + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>second</parameter></term> + <listitem> + <para> + ÃëÊý£¨Ò»·ÖÖÓÖ®ÄÚ£©¡£ + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>month</parameter></term> + <listitem> + <para> + Ô·ÝÊý¡£ + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>day</parameter></term> + <listitem> + <para> + ÌìÊý¡£ + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>year</parameter></term> + <listitem> + <para> + Äê·ÝÊý£¬¿ÉÒÔÊÇÁ½Î»»òËÄλÊý×Ö£¬0-69 ¶ÔÓ¦ÓÚ 2000-2069£¬70-100 + ¶ÔÓ¦ÓÚ 1970-2000¡£ÔÚÈç½ñϵͳÖÐÆÕ±é°Ñ time_t ×÷Ϊһ¸ö 32 + λÓзûºÅÕûÊýµÄÇé¿öÏ£¬<parameter>year</parameter> + µÄºÏ·¨·¶Î§ÊÇ 1901 µ½ 2038 Ö®¼ä£¬²»¹ý´ËÏÞÖÆ×Ô + PHP 5.1.0 ÆðÒѱ»¿Ë·þÁË¡£ + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>is_dst</parameter></term> + <listitem> + <para> + ±¾²ÎÊý¿ÉÒÔÉèΪ 1£¬±íʾÕý´¦ÓÚÏÄÊ±ÖÆÊ±¼ä£¨DST£©£¬0 + ±íʾ²»ÊÇÏÄÊ±ÖÆ£¬»òÕß -1£¨Ä¬ÈÏÖµ£©±íʾ²»ÖªµÀÊÇ·ñÊÇÏÄÊ±ÖÆ¡£Èç¹ûδ֪£¬PHP + »á³¢ÊÔ×Ô¼º¸ãÃ÷°×¡£Õâ¿ÉÄܲúÉú²»¿ÉÔ¤Öª£¨µ«²¢·Ç²»ÕýÈ·£©µÄ½á¹û¡£Èç¹û + PHP ÔËÐеÄϵͳÖÐÆôÓÃÁË DST »òÕß <parameter>is_dst</parameter> + ÉèΪ 1£¬Ä³Ð©Ê±¼äÊÇÎÞЧµÄ¡£ÀýÈç DST ×Ô 2:00 ÉúЧ£¬ÔòËùÓд¦ÓÚ + 2:00 µ½ 3:00 Ö®¼äµÄʱ¼ä¶¼ÎÞЧ£¬<function>mktime</function> + »á·µ»ØÒ»¸ö䶨Ò壨ͨ³£Îª¸º£©µÄÖµ¡£Ä³Ð©ÏµÍ³£¨ÀýÈç + Solaris 8£©µÄ DST ÔÚÎçÒ¹ÉúЧ£¬Ôò DST ÉúЧµ±ÌìµÄ 0:30 + »á±»¼ÆËãΪǰһÌìµÄ 23:30¡£ + </para> + <note> + <para> + ×Ô PHP 5.1.0 Æð£¬±¾²ÎÊýÒѱ»·ÏÆú¡£Ó¦¸ÃʹÓÃеÄÊ±Çø´¦ÀíÌØÐÔÀ´Ìæ´ú¡£ + </para> + </note> + </listitem> + </varlistentry> + </variablelist> + </para> + </refsect1> + + + <refsect1 role="returnvalues"> + &reftitle.returnvalues; + <para> + <function>mktime</function> ¸ù¾Ý¸ø³öµÄ²ÎÊý·µ»Ø Unix + ʱ¼ä´Á¡£Èç¹û²ÎÊý·Ç·¨£¨ÀýÈçÄ꣬Ô£¬ÈÕ¶¼ÊÇÁ㣩£¬±¾º¯Êý·µ»Ø + &false;£¨ÔÚ PHP 5.1 ֮ǰ·µ»Ø <literal>-1</literal>£©¡£ + </para> + </refsect1> + + <refsect1 role="changelog"> + &reftitle.changelog; + <para> + <informaltable> + <tgroup cols="2"> + <thead> + <row> + <entry>&Version;</entry> + <entry>&Description;</entry> + </row> + </thead> + <tbody> + <row> + <entry>3.0.10</entry> + <entry>¼ÓÈëÁË <parameter>is_dst</parameter> ²ÎÊý</entry> + </row> + <row> + <entry>5.1.0</entry> + <entry> + <parameter>is_dst</parameter> ²ÎÊý±»·ÏÆú¡£³ö´íʱº¯Êý·µ»Ø + &false; ¶ø²»ÔÙÊÇ <literal>-1</literal> + </entry> + </row> + </tbody> + </tgroup> + </informaltable> + </para> + </refsect1> + + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title><function>mktime</function> Àý×Ó</title> + <para> + <function>mktime</function> + ÔÚ×öÈÕÆÚ¼ÆËãºÍÑéÖ¤·½ÃæºÜÓÐÓã¬Ëü»á×Ô¶¯¼ÆË㳬³ö·¶Î§µÄÊäÈëµÄÕýÈ·Öµ¡£ÀýÈçÏÂÃæÀý×ÓÖÐÿһÐж¼»á²úÉú×Ö·û´® + "Jan-01-1998"¡£ </para> - <note> - <para> - <parameter>is_dst</parameter> ÊÇ 3.0.10 °æÐ¼ӵġ£ - </para> - </note> - <para> - <function>mktime</function> ¿ÉÒÔÓÃÀ´×öÈÕÆÚ¼ÆËãºÍÑéÖ¤£¬¶ÔÓÚ³¬³ö·¶Î§µÄÊäÈëËü¿ÉÒÔ×Ô¶¯¼ÆËã³öÕýÈ·µÄÖµÀ´¡£ÀýÈ磬ÏÂÃæµÄÿһÐж¼»áÊä³ö×Ö·û´®¡°Jan-01-1998¡±¡£ - <example> - <title><function>mktime</function> Àý×Ó</title> - <programlisting role="php"> + <programlisting role="php"> <![CDATA[ <?php -echo date ("M-d-Y", mktime (0,0,0,12,32,1997)); -echo date ("M-d-Y", mktime (0,0,0,13,1,1997)); -echo date ("M-d-Y", mktime (0,0,0,1,1,1998)); -echo date ("M-d-Y", mktime (0,0,0,1,1,98)); +echo date("M-d-Y", mktime(0, 0, 0, 12, 32, 1997)); +echo date("M-d-Y", mktime(0, 0, 0, 13, 1, 1997)); +echo date("M-d-Y", mktime(0, 0, 0, 1, 1, 1998)); +echo date("M-d-Y", mktime(0, 0, 0, 1, 1, 98)); ?> ]]> - </programlisting> - </example> - <parameter>Year</parameter> ¿ÉÒÔÊÇÁ½Î»»òËÄλÊý×Ö£¬È¡Öµ´Ó - 0-69 ±íʾ 2000-2069 ÒÔ¼° 70-99 ±íʾ 1970-1999£¨ÔÚÈç½ñºÜ³£¼ûµÄ - time_t ÊÇ 32 λÓзûºÅÕûÊýµÄϵͳÖУ¬<parameter>year</parameter> - µÄÓÐЧ·¶Î§ÊÇ 1901 µ½ 2038£©¡£ + </programlisting> + </example> + </para> + <para> + <example> + <title>ϸöÔµÄ×îºóÒ»Ìì</title> + <para> + Èκθø¶¨Ô·ݵÄ×îºóÒ»Ìì¶¼¿ÉÒÔ±»±íʾΪϸöÔÂµÄµÚ "0" + Ì죬¶ø²»ÊÇ -1 Ìì¡£ÏÂÃæÁ½¸öÀý×Ó¶¼»á²úÉú×Ö·û´® + "The last day in Feb 2000 is: 29"¡£ </para> - <para> - <note> - <title>Windows</title> - <simpara> - ĿǰËùÓÐµÄ Windows ϵͳ¶¼²»Ö§³Ö¸ºµÄʱ¼ä´Á¡£Òò´ËºÏ·¨µÄÄê·Ý·¶Î§Ö»°üÀ¨´Ó - 1970 µ½ 2038¡£ - </simpara> - </note> - </para> - <para> - ¸ø¶¨Ô·ݵÄ×îºóÒ»Ìì¿ÉÒÔ±í´ïΪϸöÔÂµÄµÚ "0" Ì죬¶ø²»ÊÇ -1 - Ìì¡£ÏÂÃæÁ½¸öÀý×Ó¶¼½«²úÉú×Ö·û´®¡°The last day in Feb 2000 is: 29¡±¡£ - <example> - <title>ÿ¸öÔµÄ×îºóÒ»Ìì</title> - <programlisting role="php"> + <programlisting role="php"> <![CDATA[ <?php -$lastday = mktime (0,0,0,3,0,2000); -echo strftime ("Last day in Feb 2000 is: %d", $lastday); - -$lastday = mktime (0,0,0,4,-31,2000); -echo strftime ("Last day in Feb 2000 is: %d", $lastday); +$lastday = mktime(0, 0, 0, 3, 0, 2000); +echo strftime("Last day in Feb 2000 is: %d", $lastday); +$lastday = mktime(0, 0, 0, 4, -31, 2000); +echo strftime("Last day in Feb 2000 is: %d", $lastday); ?> ]]> - </programlisting> - </example> - </para> - <simpara> - Ä꣬Ô£¬ÈÕ¶¼µÈÓÚÁãµÄÈÕÆÚ±»ÈÏΪÊÇ·Ç·¨µÄ£¨·ñÔò»á±»µ±×÷ - 30.11.1999£¬ÕâÊǺֵܹÄÐÐΪ£©¡£ - </simpara> - <para> - ²Î¼û <function>date</function> ºÍ <function>time</function>¡£ - </para> - </refsect1> - </refentry> + </programlisting> + </example> + </para> + </refsect1> + + <refsect1 role="notes"> + &reftitle.notes; + <caution> + <para> + ÔÚ PHP 5.1.0 ֮ǰ£¬ÔÚÈκÎÒÑÖª Windows + °æ±¾ÒÔ¼°Ò»Ð©ÆäËüϵͳϲ»Ö§³Ö¸ºµÄʱ¼ä´Á¡£Òò´ËÄê·ÝµÄÓÐЧ·¶Î§ÏÞÖÆÎª + 1970 µ½ 2038¡£ + </para> + </caution> + </refsect1> + + <refsect1 role="seealso"> + &reftitle.seealso; + <para> + <simplelist> + <member><function>gmmktime</function></member> + <member><function>date</function></member> + <member><function>time</function></member> + </simplelist> + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/diff.php/phpdoc-zh/reference/datetime/functions/strftime.xml?r1=1.6&r2=1.7&ty=u Index: phpdoc-zh/reference/datetime/functions/strftime.xml diff -u phpdoc-zh/reference/datetime/functions/strftime.xml:1.6 phpdoc-zh/reference/datetime/functions/strftime.xml:1.7 --- phpdoc-zh/reference/datetime/functions/strftime.xml:1.6 Sun Aug 17 02:41:54 2003 +++ phpdoc-zh/reference/datetime/functions/strftime.xml Tue Aug 30 16:28:19 2005 @@ -1,257 +1,253 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.6 $ --> +<!-- $Revision: 1.7 $ --> <!-- $Author: dallas $ --> -<!-- EN-Revision: 1.9 Maintainer: dallas Status: ready --> - <refentry id="function.strftime"> - <refnamediv> - <refname>strftime</refname> - <refpurpose> - ¸ù¾ÝÇøÓòÉèÖøñʽ»¯±¾µØÊ±¼ä£¯ÈÕÆÚ - </refpurpose> - </refnamediv> - <refsect1> - <title>˵Ã÷</title> - <methodsynopsis> - <type>string</type><methodname>strftime</methodname> - <methodparam><type>string</type><parameter>format</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter> - timestamp - </parameter></methodparam> - </methodsynopsis> +<!-- EN-Revision: 1.16 Maintainer: dallas Status: ready --> +<refentry id="function.strftime"> + <refnamediv> + <refname>strftime</refname> + <refpurpose>¸ù¾ÝÇøÓòÉèÖøñʽ»¯±¾µØÊ±¼ä£¯ÈÕÆÚ</refpurpose> + </refnamediv> + <refsect1> + <title>˵Ã÷</title> + <methodsynopsis> + <type>string</type><methodname>strftime</methodname> + <methodparam><type>string</type><parameter>format</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>timestamp</parameter></methodparam> + </methodsynopsis> + <para> + ·µ»ØÓøø¶¨µÄ¸ñʽ×Ö´®¶Ô¸ø³öµÄ <parameter>timestamp</parameter> + ½øÐиñʽÊä³öºóµÄ×Ö·û´®¡£Èç¹ûûÓиø³öʱ¼ä´ÁÔòÓõ±Ç°µÄ±¾µØÊ±¼ä¡£Ô·ݺÍÐÇÆÚ¼¸ÒÔ¼°ÆäËüºÍÓïÑÔÓйصÄ×Ö·û´®Ð´·¨ºÍÓà + <function>setlocale</function> É趨µÄµ±Ç°µÄÇøÓòÓйء£ + </para> + <para> + ¸ñʽ×Ö´®ÄÜʶ±ðÏÂÁÐת»»±ê¼Ç£º + <itemizedlist> + <listitem> + <simpara> + %a - µ±Ç°ÇøÓòÐÇÆÚ¼¸µÄ¼òд + </simpara> + </listitem> + <listitem> + <simpara> + %A - µ±Ç°ÇøÓòÐÇÆÚ¼¸µÄÈ«³Æ + </simpara> + </listitem> + <listitem> + <simpara> + %b - µ±Ç°ÇøÓòÔ·ݵļòд + </simpara> + </listitem> + <listitem> + <simpara> + %B - µ±Ç°ÇøÓòÔ·ݵÄÈ«³Æ + </simpara> + </listitem> + <listitem> + <simpara> + %c - µ±Ç°ÇøÓòÊ×Ñ¡µÄÈÕÆÚʱ¼ä±í´ï + </simpara> + </listitem> + <listitem> + <simpara> + %C - ÊÀ¼ÍÖµ£¨Äê·Ý³ýÒÔ 100 ºóÈ¡Õû£¬·¶Î§´Ó 00 µ½ 99£© + </simpara> + </listitem> + <listitem> + <simpara> + %d - Ô·ÝÖеĵڼ¸Ì죬ʮ½øÖÆÊý×Ö£¨·¶Î§´Ó 01 µ½ 31£© + </simpara> + </listitem> + <listitem> + <simpara> + %D - ºÍ %m/%d/%y Ò»Ñù + </simpara> + </listitem> + <listitem> + <simpara> + %e - Ô·ÝÖеĵڼ¸Ì죬ʮ½øÖÆÊý×Ö£¬Ò»Î»µÄÊý×Öǰ»á¼ÓÉÏÒ»¸ö¿Õ¸ñ£¨·¶Î§´Ó ' 1' µ½ '31'£© + </simpara> + </listitem> + <listitem> + <simpara> + %g - ºÍ %G Ò»Ñù£¬µ«ÊÇûÓÐÊÀ¼Í + </simpara> + </listitem> + <listitem> + <simpara> + %G - 4 λÊýµÄÄê·Ý£¬·ûºÏ ISO ÐÇÆÚÊý£¨²Î¼û + %V£©¡£ºÍ %V µÄ¸ñʽºÍÖµÒ»Ñù£¬Ö»³ýÁËÈç¹û ISO + ÐÇÆÚÊýÊôÓÚǰһÄê»òÕߺóÒ»Ä꣬ÔòʹÓÃÄÇÒ»Äê¡£ + </simpara> + </listitem> + <listitem> + <simpara> + %h - ºÍ %b Ò»Ñù + </simpara> + </listitem> + <listitem> + <simpara> + %H - 24 Ð¡Ê±ÖÆµÄÊ®½øÖÆÐ¡Ê±Êý£¨·¶Î§´Ó 00 µ½ 23£© + </simpara> + </listitem> + <listitem> + <simpara> + %I - 12 Ð¡Ê±ÖÆµÄÊ®½øÖÆÐ¡Ê±Êý£¨·¶Î§´Ó 00 µ½ 12£© + </simpara> + </listitem> + <listitem> + <simpara> + %j - Äê·ÝÖеĵڼ¸Ì죬ʮ½øÖÆÊý£¨·¶Î§´Ó 001 µ½ 366£© + </simpara> + </listitem> + <listitem> + <simpara> + %m - Ê®½øÖÆÔ·ݣ¨·¶Î§´Ó 01 µ½ 12£© + </simpara> + </listitem> + <listitem> + <simpara> + %M - Ê®½øÖÆ·ÖÖÓÊý + </simpara> + </listitem> + <listitem> + <simpara> + %n - »»Ðзû + </simpara> + </listitem> + <listitem> + <simpara> + %p - ¸ù¾Ý¸ø¶¨µÄʱ¼äֵΪ `am' »ò `pm'£¬»òÕßµ±Ç°ÇøÓòÉèÖÃÖеÄÏàÓ¦×Ö·û´® + </simpara> + </listitem> + <listitem> + <simpara> + %r - Óà a.m. ºÍ p.m. ·ûºÅµÄʱ¼ä + </simpara> + </listitem> + <listitem> + <simpara> + %R - 24 Сʱ·ûºÅµÄʱ¼ä + </simpara> + </listitem> + <listitem> + <simpara> + %S - Ê®½øÖÆÃëÊý + </simpara> + </listitem> + <listitem> + <simpara> + %t - ÖÆ±í·û + </simpara> + </listitem> + <listitem> + <simpara> + %T - µ±Ç°Ê±¼ä£¬ºÍ %H:%M:%S Ò»Ñù + </simpara> + </listitem> + <listitem> + <simpara> + %u - ÐÇÆÚ¼¸µÄÊ®½øÖÆÊý±í´ï [1,7]£¬1 ±íʾÐÇÆÚÒ» + </simpara> + <warning> + <simpara> + ¾¡¹Ü ISO 9889:1999£¨µ±Ç°µÄ C ±ê×¼£©Ã÷È·Ö¸³öÒ»ÖÜ´ÓÐÇÆÚÒ»¿ªÊ¼£¬µ«ÊÇ + Sun Solaris µÄÒ»ÖÜËÆºõ´ÓÐÇÆÚÌ쿪ʼ²¢×÷Ϊ 1¡£ + </simpara> + </warning> + </listitem> + <listitem> + <simpara> + %U - ±¾ÄêµÄµÚ¼¸ÖÜ£¬´ÓµÚÒ»ÖܵĵÚÒ»¸öÐÇÆÚÌì×÷ΪµÚÒ»Ì쿪ʼ + </simpara> + </listitem> + <listitem> + <simpara> + %V - ±¾ÄêµÚ¼¸ÖÜµÄ ISO 8601:1988 ¸ñʽ£¬·¶Î§´Ó 01 µ½ 53£¬µÚ + 1 ÖÜÊDZ¾ÄêµÚÒ»¸öÖÁÉÙ»¹ÓÐ 4 ÌìµÄÐÇÆÚ£¬ÐÇÆÚÒ»×÷ΪÿÖܵĵÚÒ»Ìì¡££¨Óà + %G »òÕß %g ×÷Ϊָ¶¨Ê±¼ä´ÁÏàÓ¦ÖÜÊýµÄÄê·Ý×é³É¡££© + </simpara> + </listitem> + <listitem> + <simpara> + %W - ±¾ÄêµÄµÚ¼¸ÖÜÊý£¬´ÓµÚÒ»ÖܵĵÚÒ»¸öÐÇÆÚÒ»×÷ΪµÚÒ»Ì쿪ʼ + </simpara> + </listitem> + <listitem> + <simpara> + %w - ÐÇÆÚÖеĵڼ¸Ì죬ÐÇÆÚÌìΪ 0 + </simpara> + </listitem> + <listitem> + <simpara> + %x - µ±Ç°ÇøÓòÊ×Ñ¡µÄʱ¼ä±íʾ·¨£¬²»°üÀ¨Ê±¼ä + </simpara> + </listitem> + <listitem> + <simpara> + %X - µ±Ç°ÇøÓòÊ×Ñ¡µÄʱ¼ä±íʾ·¨£¬²»°üÀ¨ÈÕÆÚ + </simpara> + </listitem> + <listitem> + <simpara> + %y - ûÓÐÊÀ¼ÍÊýµÄÊ®½øÖÆÄê·Ý£¨·¶Î§´Ó 00 µ½ 99£© + </simpara> + </listitem> + <listitem> + <simpara> + %Y - °üÀ¨ÊÀ¼ÍÊýµÄÊ®½øÖÆÄê·Ý + </simpara> + </listitem> + <listitem> + <simpara> + %Z »ò %z - Ê±ÇøÃû»òËõд + </simpara> + </listitem> + <listitem> + <simpara> + %% - ÎÄ×ÖÉ쵀 `%' ×Ö·û + </simpara> + </listitem> + </itemizedlist> + <note> <para> - ·µ»ØÓøø¶¨µÄ¸ñʽ×Ö´®¶Ô¸ø³öµÄ <parameter>timestamp</parameter> - ½øÐиñʽÊä³öºóµÄ×Ö·û´®¡£Èç¹ûûÓиø³öʱ¼ä´ÁÔòÓõ±Ç°µÄ±¾µØÊ±¼ä¡£Ô·ݺÍÐÇÆÚ¼¸ÒÔ¼°ÆäËüºÍÓïÑÔÓйصÄ×Ö·û´®Ð´·¨ºÍÓà - <function>setlocale</function> É趨µÄµ±Ç°µÄÇøÓòÓйء£ + ¿ÉÄܲ»ÊÇËùÓеÄת»»±ê¼Ç¶¼±» C ¿âÎļþÖ§³Ö£¬ÕâÖÖÇé¿öÏ PHP + µÄ <function>strftime</function> + Ò²²»Ö§³Ö¡£´ËÍ⣬²»ÊÇËùÓÐµÄÆ½Ì¨¶¼Ö§³Ö¸ºµÄʱ¼ä´Á£¬Òò´ËÈÕÆÚµÄ·¶Î§¿ÉÄÜÏÞ¶¨ÔÚ²»ÔçÓÚ + Unix ¼ÍÔª¡£ÕâÒâζ×ÅÀýÈç + %e, %T£¬%R ºÍ %D£¨¿ÉÄܸü¶à£©ÒÔ¼°ÔçÓÚ + <literal>Jan 1, 1970</literal> µÄʱ¼äÔÚ Windows£¬Ò»Ð© Linux + ·¢Ðа汾£¬ÒÔ¼°ÆäËü¼¸¸ö²Ù×÷ϵͳÖÐÎÞЧ¡£¶ÔÓÚ Windows + ϵͳ£¬ËùÖ§³ÖµÄת»»±ê¼Ç¿ÉÔÚ + <ulink url="&url.strftime.win32;"><acronym>MSDN</acronym> ÍøÕ¾</ulink>ÕÒµ½¡£ </para> - <para> - ¸ñʽ×Ö´®ÄÜʶ±ðÏÂÁÐת»»±ê¼Ç£º - <itemizedlist> - <listitem> - <simpara> - %a - µ±Ç°ÇøÓòÐÇÆÚ¼¸µÄ¼òд - </simpara> - </listitem> - <listitem> - <simpara> - %A - µ±Ç°ÇøÓòÐÇÆÚ¼¸µÄÈ«³Æ - </simpara> - </listitem> - <listitem> - <simpara> - %b - µ±Ç°ÇøÓòÔ·ݵļòд - </simpara> - </listitem> - <listitem> - <simpara> - %B - µ±Ç°ÇøÓòÔ·ݵÄÈ«³Æ - </simpara> - </listitem> - <listitem> - <simpara> - %c - µ±Ç°ÇøÓòÊ×Ñ¡µÄÈÕÆÚʱ¼ä±í´ï - </simpara> - </listitem> - <listitem> - <simpara> - %C - ÊÀ¼ÍÖµ£¨Äê·Ý³ýÒÔ 100 ºóÈ¡Õû£¬·¶Î§´Ó 00 µ½ 99£© - </simpara> - </listitem> - <listitem> - <simpara> - %d - Ô·ÝÖеĵڼ¸Ì죬ʮ½øÖÆÊý×Ö£¨·¶Î§´Ó 01 µ½ 31£© - </simpara> - </listitem> - <listitem> - <simpara> - %D - ºÍ %m/%d/%y Ò»Ñù - </simpara> - </listitem> - <listitem> - <simpara> - %e - Ô·ÝÖеĵڼ¸Ì죬ʮ½øÖÆÊý×Ö£¬Ò»Î»µÄÊý×Öǰ»á¼ÓÉÏÒ»¸ö¿Õ¸ñ£¨·¶Î§´Ó ' 1' µ½ '31'£© - </simpara> - </listitem> - <listitem> - <simpara> - %g - ºÍ %G Ò»Ñù£¬µ«ÊÇûÓÐÊÀ¼Í - </simpara> - </listitem> - <listitem> - <simpara> - %G - 4 λÊýµÄÄê·Ý£¬·ûºÏ ISO ÐÇÆÚÊý£¨²Î¼û - %V£©¡£ºÍ %V µÄ¸ñʽºÍÖµÒ»Ñù£¬Ö»³ýÁËÈç¹û ISO - ÐÇÆÚÊýÊôÓÚǰһÄê»òÕߺóÒ»Ä꣬ÔòʹÓÃÄÇÒ»Äê¡£ - </simpara> - </listitem> - <listitem> - <simpara> - %h - ºÍ %b Ò»Ñù - </simpara> - </listitem> - <listitem> - <simpara> - %H - 24 Ð¡Ê±ÖÆµÄÊ®½øÖÆÐ¡Ê±Êý£¨·¶Î§´Ó 00 µ½ 23£© - </simpara> - </listitem> - <listitem> - <simpara> - %I - 12 Ð¡Ê±ÖÆµÄÊ®½øÖÆÐ¡Ê±Êý£¨·¶Î§´Ó 00 µ½ 12£© - </simpara> - </listitem> - <listitem> - <simpara> - %j - Äê·ÝÖеĵڼ¸Ì죬ʮ½øÖÆÊý£¨·¶Î§´Ó 001 µ½ 366£© - </simpara> - </listitem> - <listitem> - <simpara> - %m - Ê®½øÖÆÔ·ݣ¨·¶Î§´Ó 01 µ½ 12£© - </simpara> - </listitem> - <listitem> - <simpara> - %M - Ê®½øÖÆ·ÖÖÓÊý - </simpara> - </listitem> - <listitem> - <simpara> - %n - »»Ðзû - </simpara> - </listitem> - <listitem> - <simpara> - %p - ¸ù¾Ý¸ø¶¨µÄʱ¼äֵΪ `am' »ò `pm'£¬»òÕßµ±Ç°ÇøÓòÉèÖÃÖеÄÏàÓ¦×Ö·û´® - </simpara> - </listitem> - <listitem> - <simpara> - %r - Óà a.m. ºÍ p.m. ·ûºÅµÄʱ¼ä - </simpara> - </listitem> - <listitem> - <simpara> - %R - 24 Сʱ·ûºÅµÄʱ¼ä - </simpara> - </listitem> - <listitem> - <simpara> - %S - Ê®½øÖÆÃëÊý - </simpara> - </listitem> - <listitem> - <simpara> - %t - ÖÆ±í·û - </simpara> - </listitem> - <listitem> - <simpara> - %T - µ±Ç°Ê±¼ä£¬ºÍ %H:%M:%S Ò»Ñù - </simpara> - </listitem> - <listitem> - <simpara> - %u - ÐÇÆÚ¼¸µÄÊ®½øÖÆÊý±í´ï [1,7]£¬1 ±íʾÐÇÆÚÒ» - </simpara> - <warning> - <simpara> - ¾¡¹Ü ISO 9889:1999£¨µ±Ç°µÄ C ±ê×¼£©Ã÷È·Ö¸³öÒ»ÖÜ´ÓÐÇÆÚÒ»¿ªÊ¼£¬µ«ÊÇ - Sun Solaris µÄÒ»ÖÜËÆºõ´ÓÐÇÆÚÌ쿪ʼ²¢×÷Ϊ 1¡£ - </simpara> - </warning> - </listitem> - <listitem> - <simpara> - %U - ±¾ÄêµÄµÚ¼¸ÖÜ£¬´ÓµÚÒ»ÖܵĵÚÒ»¸öÐÇÆÚÌì×÷ΪµÚÒ»Ì쿪ʼ - </simpara> - </listitem> - <listitem> - <simpara> - %V - ±¾ÄêµÚ¼¸ÖÜµÄ ISO 8601:1988 ¸ñʽ£¬·¶Î§´Ó 01 µ½ 53£¬µÚ - 1 ÖÜÊDZ¾ÄêµÚÒ»¸öÖÁÉÙ»¹ÓÐ 4 ÌìµÄÐÇÆÚ£¬ÐÇÆÚÒ»×÷ΪÿÖܵĵÚÒ»Ìì¡££¨Óà - %G »òÕß %g ×÷Ϊָ¶¨Ê±¼ä´ÁÏàÓ¦ÖÜÊýµÄÄê·Ý×é³É¡££© - </simpara> - </listitem> - <listitem> - <simpara> - %W - ±¾ÄêµÄµÚ¼¸ÖÜÊý£¬´ÓµÚÒ»ÖܵĵÚÒ»¸öÐÇÆÚÒ»×÷ΪµÚÒ»Ì쿪ʼ - </simpara> - </listitem> - <listitem> - <simpara> - %w - ÐÇÆÚÖеĵڼ¸Ì죬ÐÇÆÚÌìΪ 0 - </simpara> - </listitem> - <listitem> - <simpara> - %x - µ±Ç°ÇøÓòÊ×Ñ¡µÄʱ¼ä±íʾ·¨£¬²»°üÀ¨Ê±¼ä - </simpara> - </listitem> - <listitem> - <simpara> - %X - µ±Ç°ÇøÓòÊ×Ñ¡µÄʱ¼ä±íʾ·¨£¬²»°üÀ¨ÈÕÆÚ - </simpara> - </listitem> - <listitem> - <simpara> - %y - ûÓÐÊÀ¼ÍÊýµÄÊ®½øÖÆÄê·Ý£¨·¶Î§´Ó 00 µ½ 99£© - </simpara> - </listitem> - <listitem> - <simpara> - %Y - °üÀ¨ÊÀ¼ÍÊýµÄÊ®½øÖÆÄê·Ý - </simpara> - </listitem> - <listitem> - <simpara> - %Z - Ê±ÇøÃû»òËõд - </simpara> - </listitem> - <listitem> - <simpara> - %% - ÎÄ×ÖÉ쵀 `%' ×Ö·û - </simpara> - </listitem> - </itemizedlist> - <note> - <para> - ¿ÉÄܲ»ÊÇËùÓеÄת»»±ê¼Ç¶¼±» C ¿âÎļþÖ§³Ö£¬ÕâÖÖÇé¿öÏ PHP - µÄ <function>strftime</function> - Ò²²»Ö§³Ö¡£´ËÍ⣬²»ÊÇËùÓÐµÄÆ½Ì¨¶¼Ö§³Ö¸ºµÄʱ¼ä´Á£¬Òò´ËÈÕÆÚµÄ·¶Î§¿ÉÄÜÏÞ¶¨ÔÚ²»ÔçÓÚ - Unix ¼ÍÔª¡£ÕâÒâζ×ÅÀýÈç - %e, %T£¬%R ºÍ %D£¨¿ÉÄܸü¶à£©ÒÔ¼°ÔçÓÚ - <literal>Jan 1, 1970</literal> µÄʱ¼äÔÚ Windows£¬Ò»Ð© Linux - ·¢Ðа汾£¬ÒÔ¼°ÆäËü¼¸¸ö²Ù×÷ϵͳÖÐÎÞЧ¡£¶ÔÓÚ Windows - ϵͳ£¬ËùÖ§³ÖµÄת»»±ê¼Ç¿ÉÔÚ - <ulink url="&url.strftime.win32;"><acronym>MSDN</acronym> ÍøÕ¾</ulink>ÕÒµ½¡£ - </para> - </note> - <example> - <title><function>strftime</function> ÇøÓòµÄÀý×Ó</title> - <programlisting role="php"> + </note> + <example> + <title><function>strftime</function> ÇøÓòµÄÀý×Ó</title> + <programlisting role="php"> <![CDATA[ <?php -setlocale (LC_TIME, "C"); -print (strftime ("%A in Finnish is ")); -setlocale (LC_TIME, "fi_FI"); -print (strftime ("%A, in French ")); -setlocale (LC_TIME, "fr_FR"); -print (strftime ("%A and in German ")); -setlocale (LC_TIME, "de_DE"); -print (strftime ("%A.\n")); +setlocale(LC_TIME, "C"); +echo strftime("%A"); +setlocale(LC_TIME, "fi_FI"); +echo strftime(" in Finnish is %A,"); +setlocale(LC_TIME, "fr_FR"); +echo strftime(" in French %A and"); +setlocale(LC_TIME, "de_DE"); +echo strftime(" in German %A.\n"); ?> ]]> - </programlisting> - </example> - ±¾ÀýÔÚÄãµÄϵͳÖа²×°Óи÷×ÔµÄÇøÓòÉèÖúó²ÅÄܹ¤×÷¡£ - <note> - <simpara> - %G ºÍ %V£¬Èç¹ûÊý×Ö±àºÅϵͳδÄܳä·ÖÀí½â£¬»ùÓÚ ISO 8601:1988 - µÄÐÇÆÚÊý¿ÉÄܵóöδԤÆÚµÄ½á¹û¡£¼ûÉÏÃæµÄ %V ºÍÒÔϵÄÀý×Ó¡£ - </simpara> - </note> - <example> - <title>ISO 8601:1988 week number example</title> - <programlisting role="php"> + </programlisting> + </example> + ±¾ÀýÔÚÄãµÄϵͳÖа²×°Óи÷×ÔµÄÇøÓòÉèÖúó²ÅÄܹ¤×÷¡£ + <note> + <simpara> + %G ºÍ %V£¬Èç¹ûÊý×Ö±àºÅϵͳδÄܳä·ÖÀí½â£¬»ùÓÚ ISO 8601:1988 + µÄÐÇÆÚÊý¿ÉÄܵóöδԤÆÚµÄ½á¹û¡£¼ûÉÏÃæµÄ %V ºÍÒÔϵÄÀý×Ó¡£ + </simpara> + </note> + <example> + <title>ISO 8601:1988 week number example</title> + <programlisting role="php"> <![CDATA[ <?php /* December 2002 / January 2003 @@ -264,16 +260,16 @@ 3 13 14 15 16 17 18 19 */ // Outputs: 12/28/2002 - %V,%G,%Y = 52,2002,2002 -print "12/28/2002 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("12/28/2002")) . "\n"; +echo "12/28/2002 - %V,%G,%Y = " . strftime("%V,%G,%Y", strtotime("12/28/2002")) . "\n"; // Outputs: 12/30/2002 - %V,%G,%Y = 1,2003,2002 -print "12/30/2002 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("12/30/2002")) . "\n"; +echo "12/30/2002 - %V,%G,%Y = " . strftime("%V,%G,%Y", strtotime("12/30/2002")) . "\n"; // Outputs: 1/3/2003 - %V,%G,%Y = 1,2003,2003 -print "1/3/2003 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("1/3/2003")) . "\n"; +echo "1/3/2003 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("1/3/2003")) . "\n"; // Outputs: 1/10/2003 - %V,%G,%Y = 2,2003,2003 -print "1/10/2003 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("1/10/2003")) . "\n"; +echo "1/10/2003 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("1/10/2003")) . "\n"; @@ -287,29 +283,29 @@ 2 10 11 12 13 14 15 16 */ // Outputs: 12/23/2004 - %V,%G,%Y = 52,2004,2004 -print "12/23/2004 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("12/23/2004")) . "\n"; +echo "12/23/2004 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("12/23/2004")) . "\n"; // Outputs: 12/31/2004 - %V,%G,%Y = 53,2004,2004 -print "12/31/2004 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("12/31/2004")) . "\n"; +echo "12/31/2004 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("12/31/2004")) . "\n"; // Outputs: 1/2/2005 - %V,%G,%Y = 53,2004,2005 -print "1/2/2005 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("1/2/2005")) . "\n"; +echo "1/2/2005 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("1/2/2005")) . "\n"; // Outputs: 1/3/2005 - %V,%G,%Y = 1,2005,2005 -print "1/3/2005 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("1/3/2005")) . "\n"; +echo "1/3/2005 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("1/3/2005")) . "\n"; ?> ]]> - </programlisting> - </example> - </para> - <para> - ²Î¼û <function>setlocale</function> ºÍ <function>mktime</function> - ÒÔ¼° <ulink url="&spec.strftime;">Open Group specification of - <function>strftime</function></ulink>¡£ - </para> - </refsect1> - </refentry> + </programlisting> + </example> + </para> + <para> + ²Î¼û <function>setlocale</function>£¬<function>mktime</function>£¬<function>strptime</function> + ÒÔ¼° <ulink url="&spec.strftime;">Open Group specification of + <function>strftime</function></ulink>¡£ + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/diff.php/phpdoc-zh/reference/datetime/functions/strtotime.xml?r1=1.4&r2=1.5&ty=u Index: phpdoc-zh/reference/datetime/functions/strtotime.xml diff -u phpdoc-zh/reference/datetime/functions/strtotime.xml:1.4 phpdoc-zh/reference/datetime/functions/strtotime.xml:1.5 --- phpdoc-zh/reference/datetime/functions/strtotime.xml:1.4 Sun Apr 20 02:22:53 2003 +++ phpdoc-zh/reference/datetime/functions/strtotime.xml Tue Aug 30 16:28:19 2005 @@ -1,76 +1,162 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <!-- $Author: dallas $ --> -<!-- EN-Revision: 1.3 Maintainer: dallas Status: ready --> - <refentry id="function.strtotime"> - <refnamediv> - <refname>strtotime</refname> - <refpurpose> - ½«ÈκÎÓ¢ÎÄÎı¾µÄÈÕÆÚʱ¼äÃèÊö½âÎöΪ UNIX ʱ¼ä´Á - </refpurpose> - </refnamediv> - <refsect1> - <title>˵Ã÷</title> - <methodsynopsis> - <type>int</type><methodname>strtotime</methodname> - <methodparam><type>string</type><parameter>time</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>now</parameter></methodparam> - </methodsynopsis> - <simpara> - ±¾º¯ÊýÔ¤ÆÚ½ÓÊÜÒ»¸ö°üº¬Ó¢ÎÄÈÕÆÚ¸ñʽµÄ×Ö·û´®²¢³¢ÊÔ½«Æä½âÎöΪ - UNIX ʱ¼ä´Á¡£Èç¹û time µÄ¸ñʽÊǾø¶Ôʱ¼äÔò now - ²ÎÊý²»Æð×÷Óá£Èç¹û time µÄ¸ñʽÊÇÏà¶Ôʱ¼äÔòÆäËùÏà¶ÔµÄʱ¼äÓÉ - now Ìṩ£¬»òÕßÈç¹ûδÌṩ now ²ÎÊýʱÓõ±Ç°Ê±¼ä¡£Ê§°Üʱ·µ»Ø <literal>-1</literal>¡£ - </simpara> - <simpara> - ÒòΪ <function>strtotime</function> µÄÐÐΪÊÇÒÀÕÕ GNU - ÈÕÆÚÓï·¨µÄ£¬Òò´ËÇë¿´¿´ GNU ÊÖ²áÖÐµÄ - <ulink url="&url.gnu.man.date-input;">Date Input - Formats</ulink>¡£ÕâÀï¼ÇÊöÁË <parameter>time</parameter> ²ÎÊýµÄºÏ·¨Óï·¨¡£ - </simpara> - <para> - <example> - <title><function>strtotime</function> Àý×Ó</title> - <programlisting role="php"> +<!-- EN-Revision: 1.16 Maintainer: dallas Status: ready --> +<refentry id="function.strtotime"> + <refnamediv> + <refname>strtotime</refname> + <refpurpose>½«ÈκÎÓ¢ÎÄÎı¾µÄÈÕÆÚʱ¼äÃèÊö½âÎöΪ Unix ʱ¼ä´Á</refpurpose> + </refnamediv> + <refsect1 role="description"> + &reftitle.description; + <methodsynopsis> + <type>int</type><methodname>strtotime</methodname> + <methodparam><type>string</type><parameter>time</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>now</parameter></methodparam> + </methodsynopsis> + <simpara> + ±¾º¯ÊýÔ¤ÆÚ½ÓÊÜÒ»¸ö°üº¬ÃÀ¹úÓ¢ÓïÈÕÆÚ¸ñʽµÄ×Ö·û´®²¢³¢ÊÔ½«Æä½âÎöΪ + Unix ʱ¼ä´Á£¨×Ô January 1 1970 00:00:00 GMT ÆðµÄÃëÊý£©£¬ÆäÖµÏà¶ÔÓÚ + <parameter>now</parameter> ²ÎÊý¸ø³öµÄʱ¼ä£¬Èç¹ûûÓÐÌṩ´Ë²ÎÊýÔòÓÃϵͳµ±Ç°Ê±¼ä¡£ + <para> + ±¾º¯Êý½«Ê¹Óà <envar>TZ</envar> »·¾³±äÁ¿£¨Èç¹ûÓеϰ£©À´¼ÆËãʱ¼ä´Á¡£×Ô + PHP 5.1.0 ÆðÓиüÈÝÒ׵ķ½·¨À´¶¨ÒåÊ±ÇøÓÃÓÚËùÓеÄÈÕÆÚ£¯Ê±¼äº¯Êý¡£´Ë¹ý³ÌÔÚ + <function>date_default_timezone_get</function> º¯ÊýÒ³ÃæÖÐÓÐ˵Ã÷¡£ + </para> + <note> + <para> + Èç¹û¸ø¶¨µÄÄê·ÝÊÇÁ½Î»Êý×ֵĸñʽ£¬ÔòÆäÖµ 0-69 ±íʾ 2000-2069£¬70-100 + ±íʾ 1970-2000¡£ + </para> + </note> + </refsect1> + + <refsect1 role="parameters"> + &reftitle.parameters; + <para> + <variablelist> + <varlistentry> + <term><parameter>time</parameter></term> + <listitem> + <para> + ±»½âÎöµÄ×Ö·û´®£¬¸ñʽ¸ù¾Ý GNU <ulink + url="&url.gnu.man.date-input;">Date Input Formats</ulink> Óï·¨ + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>now</parameter></term> + <listitem> + <para> + ÓÃÀ´¼ÆËã·µ»ØÖµµÄʱ¼ä´Á + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </refsect1> + + <refsect1 role="returnvalues"> + &reftitle.returnvalues; + <para> + ³É¹¦Ôò·µ»ØÊ±¼ä´Á£¬·ñÔò·µ»Ø &false;¡£ÔÚ PHP 5.1.0 + ֮ǰ±¾º¯ÊýÔÚʧ°Üʱ·µ»Ø <literal>-1</literal>¡£ + </para> + </refsect1> + + <refsect1 role="changelog"> + &reftitle.changelog; + <para> + <informaltable> + <tgroup cols="2"> + <thead> + <row> + <entry>&Version;</entry> + <entry>&Description;</entry> + </row> + </thead> + <tbody> + <row> + <entry>5.1.0</entry> + <entry> + ʧ°Üʱ·µ»Ø &false;£¬²»ÔÙÊÇ <literal>-1</literal>¡£ + </entry> + </row> + </tbody> + </tgroup> + </informaltable> + </para> + </refsect1> + + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title><function>strtotime</function> Àý×Ó</title> + <programlisting role="php"> <![CDATA[ <?php -echo strtotime ("now"), "\n"; -echo strtotime ("10 September 2000"), "\n"; -echo strtotime ("+1 day"), "\n"; -echo strtotime ("+1 week"), "\n"; -echo strtotime ("+1 week 2 days 4 hours 2 seconds"), "\n"; -echo strtotime ("next Thursday"), "\n"; -echo strtotime ("last Monday"), "\n"; +echo strtotime("now"), "\n"; +echo strtotime("10 September 2000"), "\n"; +echo strtotime("+1 day"), "\n"; +echo strtotime("+1 week"), "\n"; +echo strtotime("+1 week 2 days 4 hours 2 seconds"), "\n"; +echo strtotime("next Thursday"), "\n"; +echo strtotime("last Monday"), "\n"; ?> ]]> - </programlisting> - </example> - </para> - <para> - <example> - <title>¼ì²éʧ°Ü</title> - <programlisting role="php"> + </programlisting> + </example> + </para> + <para> + <example> + <title>ʧ°Ü¼ì²é</title> + <programlisting role="php"> <![CDATA[ <?php $str = 'Not Good'; -if (($timestamp = strtotime($str)) === -1) { + +// previous to PHP 5.1.0 you would compare with -1, instead of false +if (($timestamp = strtotime($str)) === false) { echo "The string ($str) is bogus"; } else { - echo "$str == ". date('l dS of F Y h:i:s A',$timestamp); + echo "$str == " . date('l dS of F Y h:i:s A', $timestamp); } ?> ]]> - </programlisting> - </example> - </para> - <note> - <para> - ÓÐЧµÄʱ¼ä´ÁµäÐÍ·¶Î§ÊÇ´Ó¸ñÁÖÍþÖÎʱ¼ä 1901 Äê 12 Ô 13 ÈÕ ÐÇÆÚÎå 20:45:54 µ½ - 2038Äê 1 Ô 19 ÈÕ ÐÇÆÚ¶þ 03:14:07¡££¨¸ÃÈÕÆÚ¸ù¾Ý 32 λÓзûºÅÕûÊýµÄ×îСֵºÍ×î´óÖµ¶øÀ´¡££© - </para> - </note> - </refsect1> - </refentry> + </programlisting> + </example> + </para> + </refsect1> + + <refsect1 role="notes"> + &reftitle.notes; + <warning> + <para> + ÔÚ PHP 5 Öе½ 5.0.2 ֮ǰ£¬<literal>"now"</literal> + ºÍÆäËüÏà¶Ôʱ¼ä´Ó½ñÌìÎçÒ¹Æð´íÎó¼ÆËãÁË¡£ÕâºÍÕýÈ·´Óµ±Ç°Ê±¼äÆð¼ÆËãµÄÆäËü°æ±¾²»Í¬¡£ + </para> + </warning> + <note> + <para> + ÓÐЧµÄʱ¼ä´Áͨ³£´Ó Fri, 13 Dec 1901 20:45:54 GMT µ½ + Tue, 19 Jan 2038 03:14:07 GMT£¨¶ÔÓ¦ÓÚ 32 + λÓзûºÅÕûÊýµÄ×îСֵºÍ×î´óÖµ£©¡£²»ÊÇËùÓÐµÄÆ½Ì¨¶¼Ö§³Ö¸ºµÄʱ¼ä´Á£¬ÄÇôÈռǷ¶Î§¾Í±»ÏÞÖÆÎª²»ÄÜÔçÓÚ + Unix ¼ÍÔª¡£ÕâÒâζ×ÅÔÚ 1970 Äê 1 Ô 1 ÈÕ֮ǰµÄÈÕÆÚ½«²»ÄÜÓÃÔÚ Windows£¬Ò»Ð© + Linux °æ±¾£¬ÒÔ¼°¼¸¸öÆäËüµÄ²Ù×÷ϵͳÖС£²»¹ý PHP 5.1.0 ¼°¸üеİ汾¿Ë·þÁË´ËÏÞÖÆ¡£ + </para> + </note> + </refsect1> + + <refsect1 role="seealso"> + &reftitle.seealso; + <para> + <simplelist> + <member><function>strptime</function></member> + </simplelist> + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/diff.php/phpdoc-zh/reference/datetime/functions/time.xml?r1=1.3&r2=1.4&ty=u Index: phpdoc-zh/reference/datetime/functions/time.xml diff -u phpdoc-zh/reference/datetime/functions/time.xml:1.3 phpdoc-zh/reference/datetime/functions/time.xml:1.4 --- phpdoc-zh/reference/datetime/functions/time.xml:1.3 Sun Sep 29 23:07:33 2002 +++ phpdoc-zh/reference/datetime/functions/time.xml Tue Aug 30 16:28:19 2005 @@ -1,26 +1,48 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.3 $ --> +<!-- $Revision: 1.4 $ --> <!-- $Author: dallas $ --> -<!-- EN-Revision: 1.2 Maintainer: dallas Status: ready --> - <refentry id="function.time"> - <refnamediv> - <refname>time</refname> - <refpurpose>·µ»Øµ±Ç°µÄ UNIX ʱ¼ä´Á</refpurpose> - </refnamediv> - <refsect1> - <title>˵Ã÷</title> - <methodsynopsis> - <type>int</type><methodname>time</methodname> - <void/> - </methodsynopsis> - <para> - ·µ»Ø×Ô´Ó Unix мÍÔª£¨¸ñÁÖÍþÖÎʱ¼ä 1970 Äê 1 Ô 1 ÈÕ 00:00:00£©µ½µ±Ç°Ê±¼äµÄÃëÊý¡£ - </para> - <para> - ²Î¼û <function>date</function>¡£ - </para> - </refsect1> - </refentry> +<!-- EN-Revision: 1.6 Maintainer: dallas Status: ready --> +<refentry id="function.time"> + <refnamediv> + <refname>time</refname> + <refpurpose>·µ»Øµ±Ç°µÄ Unix ʱ¼ä´Á</refpurpose> + </refnamediv> + <refsect1> + <title>˵Ã÷</title> + <methodsynopsis> + <type>int</type><methodname>time</methodname> + <void/> + </methodsynopsis> + <para> + ·µ»Ø×Ô´Ó Unix ¼ÍÔª£¨¸ñÁÖÍþÖÎʱ¼ä 1970 Äê 1 Ô 1 ÈÕ 00:00:00£©µ½µ±Ç°Ê±¼äµÄÃëÊý¡£ + </para> + <para> + <example> + <title><function>time</function> Àý×Ó</title> + <programlisting role="php"> +<![CDATA[ +<?php +$nextWeek = time() + (7 * 24 * 60 * 60); + // 7 days; 24 hours; 60 mins; 60secs +echo 'Now: '. date('Y-m-d') ."\n"; +echo 'Next Week: '. date('Y-m-d', $nextWeek) ."\n"; +?> +]]> + </programlisting> + &example.outputs.similar; + <screen> +<![CDATA[ +Now: 2005-03-30 +Next Week: 2005-04-07 +]]> + </screen> + </example> + </para> + <para> + ²Î¼û <function>date</function> ºÍ <function>microtime</function>¡£ + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables:
http://cvs.php.net/diff.php/phpdoc-zh/reference/datetime/functions/checkdate.xml?r1=1.2&r2=1.3&ty=u Index: phpdoc-zh/reference/datetime/functions/checkdate.xml diff -u phpdoc-zh/reference/datetime/functions/checkdate.xml:1.2 phpdoc-zh/reference/datetime/functions/checkdate.xml:1.3 --- phpdoc-zh/reference/datetime/functions/checkdate.xml:1.2 Sun Sep 29 23:07:33 2002 +++ phpdoc-zh/reference/datetime/functions/checkdate.xml Tue Aug 30 16:28:19 2005 @@ -1,47 +1,67 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <!-- $Author: dallas $ --> -<!-- EN-Revision: 1.3 Maintainer: dallas Status: ready --> - <refentry id="function.checkdate"> - <refnamediv> - <refname>checkdate</refname> - <refpurpose>ÑéÖ¤Ò»¸ö¸ñÀï¸ßÀïÈÕÆÚ</refpurpose> - </refnamediv> - <refsect1> - <title>˵Ã÷</title> - <methodsynopsis> - <type>bool</type><methodname>checkdate</methodname> - <methodparam><type>int</type><parameter>month</parameter></methodparam> - <methodparam><type>int</type><parameter>day</parameter></methodparam> - <methodparam><type>int</type><parameter>year</parameter></methodparam> - </methodsynopsis> - <para> - Èç¹û¸ø³öµÄÈÕÆÚÓÐЧÔò·µ»Ø &true;£¬·ñÔò·µ»Ø - &false;¡£¼ì²éÓɲÎÊý¹¹³ÉµÄÈÕÆÚµÄºÏ·¨ÐÔ¡£ÈÕÆÚÔÚÒÔÏÂÇé¿öϱ»ÈÏΪÓÐЧ£º - <itemizedlist> - <listitem> - <simpara> - year µÄÖµÊÇ´Ó 1 µ½ 32767 - </simpara> - </listitem> - <listitem> - <simpara> - month µÄÖµÊÇ´Ó 1 µ½ 12 - </simpara> - </listitem> - <listitem> - <simpara> - <parameter>Day</parameter> µÄÖµÔÚ¸ø¶¨µÄ <parameter>month</parameter> - ËùÓ¦¸Ã¾ßÓеÄÌìÊý·¶Î§Ö®ÄÚ£¬ÈòÄêÒѾ¿¼ÂǽøÈ¥ÁË¡£ - </simpara> - </listitem> - </itemizedlist> - </para> - <para> - ²Î¼û <function>mktime</function> ºÍ <function>strtotime</function>¡£ - </para> - </refsect1> - </refentry> +<!-- EN-Revision: 1.7 Maintainer: dallas Status: ready --> +<refentry id="function.checkdate"> + <refnamediv> + <refname>checkdate</refname> + <refpurpose>ÑéÖ¤Ò»¸ö¸ñÀï¸ßÀïÈÕÆÚ</refpurpose> + </refnamediv> + <refsect1> + <title>˵Ã÷</title> + <methodsynopsis> + <type>bool</type><methodname>checkdate</methodname> + <methodparam><type>int</type><parameter>month</parameter></methodparam> + <methodparam><type>int</type><parameter>day</parameter></methodparam> + <methodparam><type>int</type><parameter>year</parameter></methodparam> + </methodsynopsis> + <para> + Èç¹û¸ø³öµÄÈÕÆÚÓÐЧÔò·µ»Ø &true;£¬·ñÔò·µ»Ø + &false;¡£¼ì²éÓɲÎÊý¹¹³ÉµÄÈÕÆÚµÄºÏ·¨ÐÔ¡£ÈÕÆÚÔÚÒÔÏÂÇé¿öϱ»ÈÏΪÓÐЧ£º + <itemizedlist> + <listitem> + <simpara> + year µÄÖµÊÇ´Ó 1 µ½ 32767 + </simpara> + </listitem> + <listitem> + <simpara> + month µÄÖµÊÇ´Ó 1 µ½ 12 + </simpara> + </listitem> + <listitem> + <simpara> + <parameter>Day</parameter> µÄÖµÔÚ¸ø¶¨µÄ <parameter>month</parameter> + ËùÓ¦¸Ã¾ßÓеÄÌìÊý·¶Î§Ö®ÄÚ£¬ÈòÄêÒѾ¿¼ÂǽøÈ¥ÁË¡£ + </simpara> + </listitem> + </itemizedlist> + </para> + <para> + <example> + <title><function>checkdate</function> Àý×Ó</title> + <programlisting role="php"> +<![CDATA[ +<?php +var_dump(checkdate(12, 31, 2000)); +var_dump(checkdate(2, 29, 2001)); +?> +]]> + </programlisting> + &example.outputs; + <screen> +<![CDATA[ +bool(true) +bool(false) +]]> + </screen> + </example> + </para> + <para> + ²Î¼û <function>mktime</function> ºÍ <function>strtotime</function>¡£ + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/diff.php/phpdoc-zh/reference/datetime/functions/date.xml?r1=1.8&r2=1.9&ty=u Index: phpdoc-zh/reference/datetime/functions/date.xml diff -u phpdoc-zh/reference/datetime/functions/date.xml:1.8 phpdoc-zh/reference/datetime/functions/date.xml:1.9 --- phpdoc-zh/reference/datetime/functions/date.xml:1.8 Sun Aug 17 02:34:01 2003 +++ phpdoc-zh/reference/datetime/functions/date.xml Tue Aug 30 16:28:19 2005 @@ -1,282 +1,350 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.8 $ --> +<!-- $Revision: 1.9 $ --> <!-- $Author: dallas $ --> -<!-- EN-Revision: 1.9 Maintainer: dallas Status: ready --> - <refentry id="function.date"> - <refnamediv> - <refname>date</refname> - <refpurpose>¸ñʽ»¯Ò»¸ö±¾µØÊ±¼ä£¯ÈÕÆÚ</refpurpose> - </refnamediv> - <refsect1> - <title>˵Ã÷</title> - <methodsynopsis> - <type>string</type><methodname>date</methodname> - <methodparam><type>string</type><parameter>format</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>timestamp</parameter></methodparam> - </methodsynopsis> - <para> - ·µ»Ø½«ÕûÊý <parameter>timestamp</parameter> - °´ÕÕ¸ø¶¨µÄ¸ñʽ×Ö´®¶ø²úÉúµÄ×Ö·û´®¡£Èç¹ûûÓиø³öʱ¼ä´ÁÔòʹÓñ¾µØµ±Ç°Ê±¼ä¡£»»¾ä»°Ëµ£¬<parameter>timestamp</parameter> - ÊÇ¿ÉÑ¡µÄ£¬Ä¬ÈÏֵΪ <function>time</function>¡£ - <note> - <para> - ÓÐЧµÄʱ¼ä´ÁµäÐÍ·¶Î§ÊǸñÁÖÍþÖÎʱ¼ä 1901 Äê 12 Ô 13 ÈÕ 20:45:54 - µ½ 2038 Äê 1 Ô 19 ÈÕ 03:14:07¡££¨´Ë·¶Î§·ûºÏ 32 - λÓзûºÅÕûÊýµÄ×îСֵºÍ×î´óÖµ£©¡£ÔÚ Windows ϵͳÖд˷¶Î§ÏÞÖÆÎª´Ó 1970 Äê 1 Ô 1 ÈÕµ½ - 2038 Äê 1 Ô 19 ÈÕ¡£ - </para> - </note> - <note> - <para> - Òª½«×Ö·û´®±í´ïµÄʱ¼äת»»³Éʱ¼ä´Á£¬Ó¦¸ÃʹÓà - <function>strtotime</function>¡£´ËÍâһЩÊý¾Ý¿âÓÐһЩº¯Êý½«Æäʱ¼ä¸ñʽת»»³Éʱ¼ä´Á£¨ÀýÈç - MySQL µÄ <ulink url="&url.mysql.docs.date;">UNIX_TIMESTAMP</ulink> º¯Êý£©¡£ - </para> - </note> - </para> - <para> - <table> - <title>¸ñʽ×Ö´®¿ÉÒÔʶ±ðÒÔÏ <parameter>format</parameter> ²ÎÊýµÄ×Ö·û´®</title> - <tgroup cols="3"> - <thead> - <row> - <entry><parameter>format</parameter> ×Ö·û</entry> - <entry>˵Ã÷</entry> - <entry>·µ»ØÖµÀý×Ó</entry> - </row> - </thead> - <tbody> - <row> - <entry><literal>a</literal></entry> - <entry>СдµÄÉÏÎçºÍÏÂÎçÖµ</entry> - <entry><literal>am</literal> »ò <literal>pm</literal></entry> - </row> - <row> - <entry><literal>A</literal></entry> - <entry>´óдµÄÉÏÎçºÍÏÂÎçÖµ</entry> - <entry><literal>AM</literal> »ò <literal>PM</literal></entry> - </row> - <row> - <entry><literal>B</literal></entry> - <entry>Swatch Internet ±ê׼ʱ</entry> - <entry><literal>000</literal> µ½ <literal>999</literal></entry> - </row> - <row> - <entry><literal>d</literal></entry> - <entry>Ô·ÝÖеĵڼ¸Ì죬ÓÐǰµ¼ÁãµÄ 2 λÊý×Ö</entry> - <entry><literal>01</literal> µ½ <literal>31</literal></entry> - </row> - <row> - <entry><literal>D</literal></entry> - <entry>ÐÇÆÚÖеĵڼ¸Ì죬Îı¾±íʾ£¬3 ¸ö×Öĸ</entry> - <entry><literal>Mon</literal> µ½ <literal>Sun</literal></entry> - </row> - <row> - <entry><literal>F</literal></entry> - <entry>Ô·ݣ¬ÍêÕûµÄÎı¾¸ñʽ£¬ÀýÈç January »òÕß March</entry> - <entry><literal>January</literal> µ½ <literal>December</literal></entry> - </row> - <row> - <entry><literal>g</literal></entry> - <entry>Сʱ£¬12 Сʱ¸ñʽ£¬Ã»ÓÐǰµ¼Áã</entry> - <entry><literal>1</literal> µ½ <literal>12</literal></entry> - </row> - <row> - <entry><literal>G</literal></entry> - <entry>Сʱ£¬24 Сʱ¸ñʽ£¬Ã»ÓÐǰµ¼Áã</entry> - <entry><literal>0</literal> µ½ <literal>23</literal></entry> - </row> - <row> - <entry><literal>h</literal></entry> - <entry>Сʱ£¬12 Сʱ¸ñʽ£¬ÓÐǰµ¼Áã</entry> - <entry><literal>01</literal> µ½ <literal>12</literal></entry> - </row> - <row> - <entry><literal>H</literal></entry> - <entry>Сʱ£¬24 Сʱ¸ñʽ£¬ÓÐǰµ¼Áã</entry> - <entry><literal>00</literal> µ½ <literal>23</literal></entry> - </row> - <row> - <entry><literal>i</literal></entry> - <entry>ÓÐǰµ¼ÁãµÄ·ÖÖÓÊý</entry> - <entry><literal>00</literal> µ½ <literal>59</literal>></entry> - </row> - <row> - <entry><literal>I</literal></entry> - <entry>ÊÇ·ñΪÏÄÁîʱ</entry> - <entry>Èç¹ûÊÇÏÄÁîʱΪ <literal>1</literal>£¬·ñÔòΪ <literal>0</literal></entry> - </row> - <row> - <entry><literal>j</literal></entry> - <entry>Ô·ÝÖеĵڼ¸Ì죬ûÓÐǰµ¼Áã</entry> - <entry><literal>1</literal> µ½ <literal>31</literal></entry> - </row> - <row> - <entry><literal>l</literal>£¨¡°L¡±µÄСд×Öĸ£©</entry> - <entry>ÐÇÆÚ¼¸£¬ÍêÕûµÄÎı¾¸ñʽ</entry> - <entry><literal>Sunday</literal> µ½ <literal>Saturday</literal></entry> - </row> - <row> - <entry><literal>L</literal></entry> - <entry>ÊÇ·ñΪÈòÄê</entry> - <entry>Èç¹ûÊÇÈòÄêΪ <literal>1</literal>£¬·ñÔòΪ <literal>0</literal></entry> - </row> - <row> - <entry><literal>m</literal></entry> - <entry>Êý×Ö±íʾµÄÔ·ݣ¬ÓÐǰµ¼Áã</entry> - <entry><literal>01</literal> µ½ <literal>12</literal></entry> - </row> - <row> - <entry><literal>M</literal></entry> - <entry>Èý¸ö×ÖĸËõд±íʾµÄÔ·Ý</entry> - <entry><literal>Jan</literal> µ½ <literal>Dec</literal></entry> - </row> - <row> - <entry><literal>n</literal></entry> - <entry>Êý×Ö±íʾµÄÔ·ݣ¬Ã»ÓÐǰµ¼Áã</entry> - <entry><literal>1</literal> µ½ <literal>12</literal></entry> - </row> - <row> - <entry><literal>O</literal></entry> - <entry>Óë¸ñÁÖÍþÖÎʱ¼äÏà²îµÄСʱÊý</entry> - <entry>ÀýÈ磺<literal>+0200</literal></entry> - </row> - <row> - <entry><literal>r</literal></entry> - <entry>RFC 822 ¸ñʽµÄÈÕÆÚ</entry> - <entry>ÀýÈ磺<literal>Thu, 21 Dec 2000 16:01:07 +0200</literal></entry> - </row> - <row> - <entry><literal>s</literal></entry> - <entry>ÃëÊý£¬ÓÐǰµ¼Áã</entry> - <entry><literal>00</literal> µ½ <literal>59</literal>></entry> - </row> - <row> - <entry><literal>S</literal></entry> - <entry>ÿÔÂÌìÊýºóÃæµÄÓ¢Îĺó׺£¬2 ¸ö×Ö·û</entry> - <entry><literal>st</literal>£¬<literal>nd</literal>£¬<literal>rd</literal> »òÕß <literal>th</literal>¡£¿ÉÒÔºÍ <literal>j</literal> Ò»ÆðÓá£</entry> - </row> - <row> - <entry><literal>t</literal></entry> - <entry>¸ø¶¨Ô·ÝËùÓ¦ÓеÄÌìÊý</entry> - <entry><literal>28</literal> µ½ <literal>31</literal></entry> - </row> - <row> - <entry><literal>T</literal></entry> - <entry>±¾»úËùÔÚµÄÊ±Çø</entry> - <entry>ÀýÈ磺<literal>EST</literal>£¬<literal>MDT</literal>£¨¡¾ÒëÕß×¢¡¿ÔÚ Windows - ÏÂΪÍêÕûÎı¾¸ñʽ£¬ÀýÈç¡°Eastern Standard Time¡±£¬ÖÐÎİæ»áÏÔʾ¡°Öйú±ê׼ʱ¼ä¡±£©¡£</entry> - </row> - <row> - <entry><literal>U</literal></entry> - <entry>´Ó Unix ¼ÍÔª£¨January 1 1970 00:00:00 GMT£©¿ªÊ¼ÖÁ½ñµÄÃëÊý</entry> - <entry>²Î¼û <function>time</function></entry> - </row> - <row> - <entry><literal>w</literal></entry> - <entry>ÐÇÆÚÖеĵڼ¸Ì죬Êý×Ö±íʾ</entry> - <entry><literal>0</literal>£¨±íʾÐÇÆÚÌ죩µ½ <literal>6</literal>£¨±íʾÐÇÆÚÁù£©</entry> - </row> - <row> - <entry><literal>W</literal></entry> - <entry>ISO-8601 ¸ñʽÄê·ÝÖеĵڼ¸ÖÜ£¬Ã¿ÖÜ´ÓÐÇÆÚÒ»¿ªÊ¼£¨PHP 4.1.0 мӵģ©</entry> - <entry>ÀýÈ磺<literal>42</literal>£¨µ±ÄêµÄµÚ 42 ÖÜ£©</entry> - </row> - <row> - <entry><literal>Y</literal></entry> - <entry>4 λÊý×ÖÍêÕû±íʾµÄÄê·Ý</entry> - <entry>ÀýÈ磺<literal>1999</literal> »ò <literal>2003</literal></entry> - </row> - <row> - <entry><literal>y</literal></entry> - <entry>2 λÊý×Ö±íʾµÄÄê·Ý</entry> - <entry>ÀýÈ磺<literal>99</literal> »ò <literal>03</literal></entry> - </row> - <row> - <entry><literal>z</literal></entry> - <entry>Äê·ÝÖеĵڼ¸Ìì</entry> - <entry><literal>0</literal> µ½ <literal>366</literal></entry> - </row> - <row> - <entry><literal>Z</literal></entry> - <entry>ʱ²îÆ«ÒÆÁ¿µÄÃëÊý¡£UTC Î÷±ßµÄÊ±ÇøÆ«ÒÆÁ¿×ÜÊǸºµÄ£¬UTC ¶«±ßµÄÊ±ÇøÆ«ÒÆÁ¿×ÜÊÇÕýµÄ¡£</entry> - <entry><literal>-43200</literal> µ½ <literal>43200</literal></entry> - </row> - </tbody> - </tgroup> - </table> - </para> - <para> - ¸ñʽ×Ö´®Öв»Äܱ»Ê¶±ðµÄ×Ö·û½«ÔÑùÏÔʾ¡£<literal>Z</literal> ¸ñʽÔÚʹÓà <function>gmdate</function> ʱ×ÜÊÇ·µ»Ø <literal>0</literal>¡£ - </para> - <para> - <example> - <title><function>date</function> Àý×Ó</title> - <programlisting role="php"> +<!-- EN-Revision: 1.21 Maintainer: dallas Status: ready --> +<refentry id="function.date"> + <refnamediv> + <refname>date</refname> + <refpurpose>¸ñʽ»¯Ò»¸ö±¾µØÊ±¼ä£¯ÈÕÆÚ</refpurpose> + </refnamediv> + <refsect1> + <title>˵Ã÷</title> + <methodsynopsis> + <type>string</type><methodname>date</methodname> + <methodparam><type>string</type><parameter>format</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>timestamp</parameter></methodparam> + </methodsynopsis> + <para> + ·µ»Ø½«ÕûÊý <parameter>timestamp</parameter> + °´ÕÕ¸ø¶¨µÄ¸ñʽ×Ö´®¶ø²úÉúµÄ×Ö·û´®¡£Èç¹ûûÓиø³öʱ¼ä´ÁÔòʹÓñ¾µØµ±Ç°Ê±¼ä¡£»»¾ä»°Ëµ£¬<parameter>timestamp</parameter> + ÊÇ¿ÉÑ¡µÄ£¬Ä¬ÈÏֵΪ <function>time</function>¡£ + </para> + <tip> + <para> + ×Ô PHP 5.1.0 ÆðÓм¸¸öÓÐÓõÄ<link + linkend="datetime.constants">³£Á¿</link>¿ÉÓÃ×÷±ê×¼µÄÈÕÆÚ£¯Ê±¼ä¸ñʽÀ´Ö¸¶¨ + <parameter>format</parameter> ²ÎÊý¡£ + </para> + </tip> + <note> + <para> + ÓÐЧµÄʱ¼ä´ÁµäÐÍ·¶Î§ÊǸñÁÖÍþÖÎʱ¼ä 1901 Äê 12 Ô 13 ÈÕ 20:45:54 + µ½ 2038 Äê 1 Ô 19 ÈÕ 03:14:07¡££¨´Ë·¶Î§·ûºÏ 32 + λÓзûºÅÕûÊýµÄ×îСֵºÍ×î´óÖµ£©¡£²»¹ýÔÚ PHP 5.1 ֮ǰ´Ë·¶Î§ÔÚijЩϵͳ£¨Èç + Windows£©ÖÐÏÞÖÆÎª´Ó 1970 Äê 1 Ô 1 ÈÕµ½ 2038 Äê 1 Ô 19 ÈÕ¡£ + </para> + </note> + <note> + <para> + Òª½«×Ö·û´®±í´ïµÄʱ¼äת»»³Éʱ¼ä´Á£¬Ó¦¸ÃʹÓà + <function>strtotime</function>¡£´ËÍâһЩÊý¾Ý¿âÓÐһЩº¯Êý½«Æäʱ¼ä¸ñʽת»»³Éʱ¼ä´Á£¨ÀýÈç + MySQL µÄ <ulink url="&url.mysql.docs.date;">UNIX_TIMESTAMP</ulink> º¯Êý£©¡£ + </para> + </note> + <para> + <table> + <title>¸ñʽ×Ö´®¿ÉÒÔʶ±ðÒÔÏ <parameter>format</parameter> ²ÎÊýµÄ×Ö·û´®</title> + <tgroup cols="3"> + <thead> + <row> + <entry><parameter>format</parameter> ×Ö·û</entry> + <entry>˵Ã÷</entry> + <entry>·µ»ØÖµÀý×Ó</entry> + </row> + </thead> + <tbody> + <row> + <entry align="center"><emphasis>ÈÕ</emphasis></entry> + <entry>---</entry> + <entry>---</entry> + </row> + <row> + <entry><literal>d</literal></entry> + <entry>Ô·ÝÖеĵڼ¸Ì죬ÓÐǰµ¼ÁãµÄ 2 λÊý×Ö</entry> + <entry><literal>01</literal> µ½ <literal>31</literal></entry> + </row> + <row> + <entry><literal>D</literal></entry> + <entry>ÐÇÆÚÖеĵڼ¸Ì죬Îı¾±íʾ£¬3 ¸ö×Öĸ</entry> + <entry><literal>Mon</literal> µ½ <literal>Sun</literal></entry> + </row> + <row> + <entry><literal>j</literal></entry> + <entry>Ô·ÝÖеĵڼ¸Ì죬ûÓÐǰµ¼Áã</entry> + <entry><literal>1</literal> µ½ <literal>31</literal></entry> + </row> + <row> + <entry><literal>l</literal>£¨¡°L¡±µÄСд×Öĸ£©</entry> + <entry>ÐÇÆÚ¼¸£¬ÍêÕûµÄÎı¾¸ñʽ</entry> + <entry><literal>Sunday</literal> µ½ <literal>Saturday</literal></entry> + </row> + <row> + <entry><literal>S</literal></entry> + <entry>ÿÔÂÌìÊýºóÃæµÄÓ¢Îĺó׺£¬2 ¸ö×Ö·û</entry> + <entry><literal>st</literal>£¬<literal>nd</literal>£¬<literal>rd</literal> + »òÕß <literal>th</literal>¡£¿ÉÒÔºÍ <literal>j</literal> Ò»ÆðÓÃ</entry> + </row> + <row> + <entry><literal>w</literal></entry> + <entry>ÐÇÆÚÖеĵڼ¸Ì죬Êý×Ö±íʾ</entry> + <entry><literal>0</literal>£¨±íʾÐÇÆÚÌ죩µ½ <literal>6</literal>£¨±íʾÐÇÆÚÁù£©</entry> + </row> + <row> + <entry><literal>z</literal></entry> + <entry>Äê·ÝÖеĵڼ¸Ìì</entry> + <entry><literal>0</literal> µ½ <literal>366</literal></entry> + </row> + <row> + <entry align="center"><emphasis>ÐÇÆÚ</emphasis></entry> + <entry>---</entry> + <entry>---</entry> + </row> + <row> + <entry><literal>W</literal></entry> + <entry>ISO-8601 ¸ñʽÄê·ÝÖеĵڼ¸ÖÜ£¬Ã¿ÖÜ´ÓÐÇÆÚÒ»¿ªÊ¼£¨PHP 4.1.0 мӵģ©</entry> + <entry>ÀýÈ磺<literal>42</literal>£¨µ±ÄêµÄµÚ 42 ÖÜ£©</entry> + </row> + <row> + <entry align="center"><emphasis>ÔÂ</emphasis></entry> + <entry>---</entry> + <entry>---</entry> + </row> + <row> + <entry><literal>F</literal></entry> + <entry>Ô·ݣ¬ÍêÕûµÄÎı¾¸ñʽ£¬ÀýÈç January »òÕß March</entry> + <entry><literal>January</literal> µ½ <literal>December</literal></entry> + </row> + <row> + <entry><literal>m</literal></entry> + <entry>Êý×Ö±íʾµÄÔ·ݣ¬ÓÐǰµ¼Áã</entry> + <entry><literal>01</literal> µ½ <literal>12</literal></entry> + </row> + <row> + <entry><literal>M</literal></entry> + <entry>Èý¸ö×ÖĸËõд±íʾµÄÔ·Ý</entry> + <entry><literal>Jan</literal> µ½ <literal>Dec</literal></entry> + </row> + <row> + <entry><literal>n</literal></entry> + <entry>Êý×Ö±íʾµÄÔ·ݣ¬Ã»ÓÐǰµ¼Áã</entry> + <entry><literal>1</literal> µ½ <literal>12</literal></entry> + </row> + <row> + <entry><literal>t</literal></entry> + <entry>¸ø¶¨Ô·ÝËùÓ¦ÓеÄÌìÊý</entry> + <entry><literal>28</literal> µ½ <literal>31</literal></entry> + </row> + <row> + <entry align="center"><emphasis>Äê</emphasis></entry> + <entry>---</entry> + <entry>---</entry> + </row> + <row> + <entry><literal>L</literal></entry> + <entry>ÊÇ·ñΪÈòÄê</entry> + <entry>Èç¹ûÊÇÈòÄêΪ <literal>1</literal>£¬·ñÔòΪ <literal>0</literal></entry> + </row> + <row> + <entry><literal>o</literal></entry> + <entry>ISO-8601 ¸ñʽÄê·ÝÊý×Ö¡£ÕâºÍ + <literal>Y</literal> µÄÖµÏàͬ£¬Ö»³ýÁËÈç¹û ISO + µÄÐÇÆÚÊý£¨<literal>W</literal>£©ÊôÓÚǰһÄê»òÏÂÒ»Ä꣬ÔòÓÃÄÇÒ»Äê¡££¨PHP 5.1.0 мӣ©</entry> + <entry>Examples: <literal>1999</literal> or <literal>2003</literal></entry> + </row> + <row> + <entry><literal>Y</literal></entry> + <entry>4 λÊý×ÖÍêÕû±íʾµÄÄê·Ý</entry> + <entry>ÀýÈ磺<literal>1999</literal> »ò <literal>2003</literal></entry> + </row> + <row> + <entry><literal>y</literal></entry> + <entry>2 λÊý×Ö±íʾµÄÄê·Ý</entry> + <entry>ÀýÈ磺<literal>99</literal> »ò <literal>03</literal></entry> + </row> + <row> + <entry align="center"><emphasis>ʱ¼ä</emphasis></entry> + <entry>---</entry> + <entry>---</entry> + </row> + <row> + <entry><literal>a</literal></entry> + <entry>СдµÄÉÏÎçºÍÏÂÎçÖµ</entry> + <entry><literal>am</literal> »ò <literal>pm</literal></entry> + </row> + <row> + <entry><literal>A</literal></entry> + <entry>´óдµÄÉÏÎçºÍÏÂÎçÖµ</entry> + <entry><literal>AM</literal> »ò <literal>PM</literal></entry> + </row> + <row> + <entry><literal>B</literal></entry> + <entry>Swatch Internet ±ê׼ʱ</entry> + <entry><literal>000</literal> µ½ <literal>999</literal></entry> + </row> + <row> + <entry><literal>g</literal></entry> + <entry>Сʱ£¬12 Сʱ¸ñʽ£¬Ã»ÓÐǰµ¼Áã</entry> + <entry><literal>1</literal> µ½ <literal>12</literal></entry> + </row> + <row> + <entry><literal>G</literal></entry> + <entry>Сʱ£¬24 Сʱ¸ñʽ£¬Ã»ÓÐǰµ¼Áã</entry> + <entry><literal>0</literal> µ½ <literal>23</literal></entry> + </row> + <row> + <entry><literal>h</literal></entry> + <entry>Сʱ£¬12 Сʱ¸ñʽ£¬ÓÐǰµ¼Áã</entry> + <entry><literal>01</literal> µ½ <literal>12</literal></entry> + </row> + <row> + <entry><literal>H</literal></entry> + <entry>Сʱ£¬24 Сʱ¸ñʽ£¬ÓÐǰµ¼Áã</entry> + <entry><literal>00</literal> µ½ <literal>23</literal></entry> + </row> + <row> + <entry><literal>i</literal></entry> + <entry>ÓÐǰµ¼ÁãµÄ·ÖÖÓÊý</entry> + <entry><literal>00</literal> µ½ <literal>59</literal>></entry> + </row> + <row> + <entry><literal>s</literal></entry> + <entry>ÃëÊý£¬ÓÐǰµ¼Áã</entry> + <entry><literal>00</literal> µ½ <literal>59</literal>></entry> + </row> + <row> + <entry align="center"><emphasis>Ê±Çø</emphasis></entry> + <entry>---</entry> + <entry>---</entry> + </row> + <row> + <entry><literal>e</literal></entry> + <entry>Ê±Çø±êʶ£¨PHP 5.1.0 мӣ©</entry> + <entry>ÀýÈ磺<literal>UTC</literal>£¬<literal>GMT</literal>£¬<literal>Atlantic/Azores</literal></entry> + </row> + <row> + <entry><literal>I</literal></entry> + <entry>ÊÇ·ñΪÏÄÁîʱ</entry> + <entry>Èç¹ûÊÇÏÄÁîʱΪ <literal>1</literal>£¬·ñÔòΪ <literal>0</literal></entry> + </row> + <row> + <entry><literal>O</literal></entry> + <entry>Óë¸ñÁÖÍþÖÎʱ¼äÏà²îµÄСʱÊý</entry> + <entry>ÀýÈ磺<literal>+0200</literal></entry> + </row> + <row> + <entry><literal>T</literal></entry> + <entry>±¾»úËùÔÚµÄÊ±Çø</entry> + <entry>ÀýÈ磺<literal>EST</literal>£¬<literal>MDT</literal>£¨¡¾ÒëÕß×¢¡¿ÔÚ Windows + ÏÂΪÍêÕûÎı¾¸ñʽ£¬ÀýÈç¡°Eastern Standard Time¡±£¬ÖÐÎİæ»áÏÔʾ¡°Öйú±ê׼ʱ¼ä¡±£©¡£</entry> + </row> + <row> + <entry><literal>Z</literal></entry> + <entry>ʱ²îÆ«ÒÆÁ¿µÄÃëÊý¡£UTC Î÷±ßµÄÊ±ÇøÆ«ÒÆÁ¿×ÜÊǸºµÄ£¬UTC ¶«±ßµÄÊ±ÇøÆ«ÒÆÁ¿×ÜÊÇÕýµÄ¡£</entry> + <entry><literal>-43200</literal> µ½ <literal>43200</literal></entry> + </row> + <row> + <entry align="center"><emphasis>ÍêÕûµÄÈÕÆÚ£¯Ê±¼ä</emphasis></entry> + <entry>---</entry> + <entry>---</entry> + </row> + <row> + <entry><literal>c</literal></entry> + <entry>ISO 8601 ¸ñʽµÄÈÕÆÚ£¨PHP 5 мӣ©</entry> + <entry>2004-02-12T15:19:21+00:00</entry> + </row> + <row> + <entry><literal>r</literal></entry> + <entry>RFC 822 ¸ñʽµÄÈÕÆÚ</entry> + <entry>ÀýÈ磺<literal>Thu, 21 Dec 2000 16:01:07 +0200</literal></entry> + </row> + <row> + <entry><literal>U</literal></entry> + <entry>´Ó Unix ¼ÍÔª£¨January 1 1970 00:00:00 GMT£©¿ªÊ¼ÖÁ½ñµÄÃëÊý</entry> + <entry>²Î¼û <function>time</function></entry> + </row> + </tbody> + </tgroup> + </table> + </para> + <para> + ¸ñʽ×Ö´®Öв»Äܱ»Ê¶±ðµÄ×Ö·û½«ÔÑùÏÔʾ¡£<literal>Z</literal> ¸ñʽÔÚʹÓà + <function>gmdate</function> ʱ×ÜÊÇ·µ»Ø <literal>0</literal>¡£ + </para> + <para> + <example> + <title><function>date</function> Àý×Ó</title> + <programlisting role="php"> <![CDATA[ <?php -// Prints something like: Wednesday +// É趨ҪÓõÄĬÈÏÊ±Çø¡£×Ô PHP 5.1 ¿ÉÓà +date_default_timezone_set('UTC'); + + +// Êä³öÀàËÆ£ºMonday echo date("l"); -// Prints something like: Wednesday 15th of January 2003 05:51:38 AM -echo date ("l dS of F Y h:i:s A"); +// Êä³öÀàËÆ£ºMonday 15th of August 2005 03:12:46 PM +echo date('l dS \of F Y h:i:s A'); + +// Êä³ö£ºJuly 1, 2000 is on a Saturday +echo "July 1, 2000 is on a " . date("l", mktime(0, 0, 0, 7, 1, 2000)); + +/* ÔÚ¸ñʽ²ÎÊýÖÐʹÓó£Á¿ */ +// Êä³öÀàËÆ£ºMon, 15 Aug 2005 15:12:46 UTC +echo date(DATE_RFC822); -// Prints: July 1, 2000 is on a Saturday -echo "July 1, 2000 is on a " . date ("l", mktime(0,0,0,7,1,2000)); +// Êä³öÀàËÆ£º2000-07-01T00:00:00+0000 +echo date(DATE_ATOM, mktime(0, 0, 0, 7, 1, 2000)); ?> ]]> - </programlisting> - </example> - </para> - <para> - ÔÚ¸ñʽ×Ö´®ÖеÄ×Ö·ûǰ¼ÓÉÏ·´Ð±ÏßÀ´×ªÒå¿ÉÒÔ±ÜÃâËü±»°´ÕÕÉϱí½âÊÍ¡£Èç¹û¼ÓÉÏ·´Ð±ÏߺóµÄ×Ö·û±¾Éí¾ÍÊÇÒ»¸öÌØÊâÐòÁУ¬ÄÇ»¹Òª×ªÒ巴бÏß¡£ - <example> - <title>ÔÚ <function>date</function> ÖÐתÒå×Ö·û</title> - <programlisting role="php"> + </programlisting> + </example> + </para> + <para> + ÔÚ¸ñʽ×Ö´®ÖеÄ×Ö·ûǰ¼ÓÉÏ·´Ð±ÏßÀ´×ªÒå¿ÉÒÔ±ÜÃâËü±»°´ÕÕÉϱí½âÊÍ¡£Èç¹û¼ÓÉÏ·´Ð±ÏߺóµÄ×Ö·û±¾Éí¾ÍÊÇÒ»¸öÌØÊâÐòÁУ¬ÄÇ»¹Òª×ªÒ巴бÏß¡£ + <example> + <title>ÔÚ <function>date</function> ÖÐתÒå×Ö·û</title> + <programlisting role="php"> <![CDATA[ <?php // prints something like: Wednesday the 15th echo date("l \\t\h\e jS"); ?> ]]> - </programlisting> - </example> - </para> - <para> - ¿ÉÒÔ°Ñ <function>date</function> ºÍ - <function>mktime</function> ½áºÏʹÓÃÀ´µÃµ½Î´À´»ò¹ýÈ¥µÄÈÕÆÚ¡£ - <example> - <title> - <function>date</function> ºÍ <function>mktime</function> Àý×Ó - </title> - <programlisting role="php"> + </programlisting> + </example> + </para> + <para> + ¿ÉÒÔ°Ñ <function>date</function> ºÍ + <function>mktime</function> ½áºÏʹÓÃÀ´µÃµ½Î´À´»ò¹ýÈ¥µÄÈÕÆÚ¡£ + <example> + <title><function>date</function> ºÍ <function>mktime</function> Àý×Ó</title> + <programlisting role="php"> <![CDATA[ <?php -$tomorrow = mktime (0,0,0,date("m") ,date("d")+1,date("Y")); -$lastmonth = mktime (0,0,0,date("m")-1,date("d"), date("Y")); -$nextyear = mktime (0,0,0,date("m"), date("d"), date("Y")+1); +$tomorrow = mktime(0, 0, 0, date("m") , date("d")+1, date("Y")); +$lastmonth = mktime(0, 0, 0, date("m")-1, date("d"), date("Y")); +$nextyear = mktime(0, 0, 0, date("m"), date("d"), date("Y")+1); ?> ]]> - </programlisting> - </example> - <note> - <para> - ÓÉÓÚÏÄÁîʱµÄÔµ¹Ê£¬ÕâÖÖ·½·¨±È¼òµ¥µØÔÚʱ¼ä´ÁÉϼӼõÒ»Ìì»òÕßÒ»¸öÔµÄÃëÊý¸ü¿É¿¿¡£ - </para> - </note> - </para> + </programlisting> + </example> + <note> <para> - һЩʹÓà <function>date</function> - ¸ñʽ»¯ÈÕÆÚµÄÀý×Ó¡£×¢ÒâҪתÒåËùÓÐÆäËüµÄ×Ö·û£¬ÒòΪĿǰÓÐÌØÊ⺬ÒåµÄ×Ö·û»á²úÉú²»ÐèÒªµÄ½á¹û£¬¶øÆäÓà×Ö·ûÔÚ - PHP ½«À´µÄ°æ±¾ÖпÉÄܻᱻÓÃÉÏ¡£µ±×ªÒåʱ£¬×¢ÒâÓõ¥ÒýºÅÒÔ±ÜÃâÀàËÆ \n µÄ×Ö·û±ä³ÉÁË»»Ðзû¡£ - <example> - <title> - <function>date</function> Formatting - </title> - <programlisting role="php"> + ÓÉÓÚÏÄÁîʱµÄÔµ¹Ê£¬ÕâÖÖ·½·¨±È¼òµ¥µØÔÚʱ¼ä´ÁÉϼӼõÒ»Ìì»òÕßÒ»¸öÔµÄÃëÊý¸ü¿É¿¿¡£ + </para> + </note> + </para> + <para> + һЩʹÓà <function>date</function> + ¸ñʽ»¯ÈÕÆÚµÄÀý×Ó¡£×¢ÒâҪתÒåËùÓÐÆäËüµÄ×Ö·û£¬ÒòΪĿǰÓÐÌØÊ⺬ÒåµÄ×Ö·û»á²úÉú²»ÐèÒªµÄ½á¹û£¬¶øÆäÓà×Ö·ûÔÚ + PHP ½«À´µÄ°æ±¾ÖпÉÄܻᱻÓÃÉÏ¡£µ±×ªÒåʱ£¬×¢ÒâÓõ¥ÒýºÅÒÔ±ÜÃâÀàËÆ \n µÄ×Ö·û±ä³ÉÁË»»Ðзû¡£ + <example> + <title><function>date</function> ¸ñʽ¾ÙÀý</title> + <programlisting role="php"> <![CDATA[ <?php -// Assuming today is: March 10th, 2001, 5:16:18 pm +// ¼Ù¶¨½ñÌìÊÇ£ºMarch 10th, 2001, 5:16:18 pm $today = date("F j, Y, g:i a"); // March 10, 2001, 5:16 pm $today = date("m.d.y"); // 03.10.01 $today = date("j, n, Y"); // 10, 3, 2001 @@ -288,18 +356,19 @@ $today = date("H:i:s"); // 17:16:17 ?> ]]> - </programlisting> - </example> - </para> - <para> - Òª¸ñʽ»¯ÆäËüÓïÖÖµÄÈÕÆÚ£¬Ó¦¸ÃÓà <function>setlocale</function> ºÍ - <function>strftime</function> º¯Êý¡£ - </para> - <para> - ²Î¼û <function>getlastmod</function>£¬<function>gmdate</function>£¬<function>mktime</function>£¬<function>strftime</function> ºÍ <function>time</function>¡£ - </para> - </refsect1> - </refentry> + </programlisting> + </example> + </para> + <para> + Òª¸ñʽ»¯ÆäËüÓïÖÖµÄÈÕÆÚ£¬Ó¦¸ÃÓà <function>setlocale</function> ºÍ + <function>strftime</function> º¯Êý¡£ + </para> + <para> + ²Î¼û <function>getlastmod</function>£¬<function>gmdate</function>£¬<function>mktime</function>£¬<function>strftime</function> + ºÍ <function>time</function>¡£ + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/diff.php/phpdoc-zh/reference/datetime/functions/getdate.xml?r1=1.4&r2=1.5&ty=u Index: phpdoc-zh/reference/datetime/functions/getdate.xml diff -u phpdoc-zh/reference/datetime/functions/getdate.xml:1.4 phpdoc-zh/reference/datetime/functions/getdate.xml:1.5 --- phpdoc-zh/reference/datetime/functions/getdate.xml:1.4 Sun Aug 17 02:34:01 2003 +++ phpdoc-zh/reference/datetime/functions/getdate.xml Tue Aug 30 16:28:19 2005 @@ -1,116 +1,112 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <!-- $Author: dallas $ --> -<!-- EN-Revision: 1.8 Maintainer: dallas Status: ready --> - <refentry id="function.getdate"> - <refnamediv> - <refname>getdate</refname> - <refpurpose>È¡µÃÈÕÆÚ£¯Ê±¼äÐÅÏ¢</refpurpose> - </refnamediv> - <refsect1> - <title>˵Ã÷</title> - <methodsynopsis> - <type>array</type><methodname>getdate</methodname> - <methodparam choice="opt"><type>int</type><parameter>timestamp</parameter></methodparam> - </methodsynopsis> - <para> - ·µ»ØÒ»¸ö¸ù¾Ý <parameter>timestamp</parameter> - µÃ³öµÄ°üº¬ÓÐÈÕÆÚÐÅÏ¢µÄ½áºÏÊý×é¡£Èç¹ûûÓиø³öʱ¼ä´ÁÔòÈÏΪÊǵ±Ç°±¾µØÊ±¼ä¡£Êý×éÖеĵ¥ÔªÈçÏ£º - </para> - <para> - <table> - <title>·µ»ØµÄ¹ØÁªÊý×éÖеļüÃûµ¥Ôª</title> - <tgroup cols="3"> - <thead> - <row> - <entry>¼üÃû</entry> - <entry>˵Ã÷</entry> - <entry>·µ»ØÖµÀý×Ó</entry> - </row> - </thead> - <tbody> - <row> - <entry><literal>"seconds"</literal></entry> - <entry>ÃëµÄÊý×Ö±íʾ</entry> - <entry><literal>0</literal> µ½ <literal>59</literal></entry> - </row> - <row> - <entry><literal>"minutes"</literal></entry> - <entry>·ÖÖÓµÄÊý×Ö±íʾ</entry> - <entry><literal>0</literal> µ½ <literal>59</literal></entry> - </row> - <row> - <entry><literal>"hours"</literal></entry> - <entry>СʱµÄÊý×Ö±íʾ</entry> - <entry><literal>0</literal> µ½ <literal>23</literal></entry> - </row> - <row> - <entry><literal>"mday"</literal></entry> - <entry>Ô·ÝÖеڼ¸ÌìµÄÊý×Ö±íʾ</entry> - <entry><literal>1</literal> µ½ <literal>31</literal></entry> - </row> - <row> - <entry><literal>"wday"</literal></entry> - <entry>ÐÇÆÚÖеڼ¸ÌìµÄÊý×Ö±íʾ</entry> - <entry><literal>0</literal>£¨±íʾÐÇÆÚÌ죩µ½ <literal>6</literal>£¨±íʾÐÇÆÚÁù£©</entry> - </row> - <row> - <entry><literal>"mon"</literal></entry> - <entry>Ô·ݵÄÊý×Ö±íʾ</entry> - <entry><literal>1</literal> µ½ <literal>12</literal></entry> - </row> - <row> - <entry><literal>"year"</literal></entry> - <entry>4 λÊý×Ö±íʾµÄÍêÕûÄê·Ý</entry> - <entry>ÀýÈ磺<literal>1999</literal> »ò <literal>2003</literal></entry> - </row> - <row> - <entry><literal>"yday"</literal></entry> - <entry>Ò»ÄêÖеڼ¸ÌìµÄÊý×Ö±íʾ</entry> - <entry><literal>0</literal> µ½ <literal>366</literal></entry> - </row> - <row> - <entry><literal>"weekday"</literal></entry> - <entry>ÐÇÆÚ¼¸µÄÍêÕûÎı¾±íʾ</entry> - <entry><literal>Sunday</literal> µ½ <literal>Saturday</literal></entry> - </row> - <row> - <entry><literal>"month"</literal></entry> - <entry>Ô·ݵÄÍêÕûÎı¾±íʾ</entry> - <entry><literal>January></literal> µ½ <literal>December</literal></entry> - </row> - <row> - <entry><literal>0</literal></entry> - <entry> - ×Ô´Ó Unix ¼ÍÔª¿ªÊ¼ÖÁ½ñµÄÃëÊý£¬ºÍ <function>time</function> - µÄ·µ»ØÖµÒÔ¼°ÓÃÓÚ <function>date</function> µÄÖµÀàËÆ¡£ - </entry> - <entry> - ϵͳÏà¹Ø£¬µäÐÍֵΪ´Ó <literal>-2147483648</literal> µ½ - <literal>2147483647</literal>¡£ - </entry> - </row> - </tbody> - </tgroup> - </table> - </para> - <para> - <example> - <title> - <function>getdate</function> Àý×Ó - </title> - <programlisting role="php"> +<!-- EN-Revision: 1.11 Maintainer: dallas Status: ready --> +<refentry id="function.getdate"> + <refnamediv> + <refname>getdate</refname> + <refpurpose>È¡µÃÈÕÆÚ£¯Ê±¼äÐÅÏ¢</refpurpose> + </refnamediv> + <refsect1> + <title>˵Ã÷</title> + <methodsynopsis> + <type>array</type><methodname>getdate</methodname> + <methodparam choice="opt"><type>int</type><parameter>timestamp</parameter></methodparam> + </methodsynopsis> + <para> + ·µ»ØÒ»¸ö¸ù¾Ý <parameter>timestamp</parameter> + µÃ³öµÄ°üº¬ÓÐÈÕÆÚÐÅÏ¢µÄ½áºÏÊý×é¡£Èç¹ûûÓиø³öʱ¼ä´ÁÔòÈÏΪÊǵ±Ç°±¾µØÊ±¼ä¡£Êý×éÖеĵ¥ÔªÈçÏ£º + </para> + <para> + <table> + <title>·µ»ØµÄ¹ØÁªÊý×éÖеļüÃûµ¥Ôª</title> + <tgroup cols="3"> + <thead> + <row> + <entry>¼üÃû</entry> + <entry>˵Ã÷</entry> + <entry>·µ»ØÖµÀý×Ó</entry> + </row> + </thead> + <tbody> + <row> + <entry><literal>"seconds"</literal></entry> + <entry>ÃëµÄÊý×Ö±íʾ</entry> + <entry><literal>0</literal> µ½ <literal>59</literal></entry> + </row> + <row> + <entry><literal>"minutes"</literal></entry> + <entry>·ÖÖÓµÄÊý×Ö±íʾ</entry> + <entry><literal>0</literal> µ½ <literal>59</literal></entry> + </row> + <row> + <entry><literal>"hours"</literal></entry> + <entry>СʱµÄÊý×Ö±íʾ</entry> + <entry><literal>0</literal> µ½ <literal>23</literal></entry> + </row> + <row> + <entry><literal>"mday"</literal></entry> + <entry>Ô·ÝÖеڼ¸ÌìµÄÊý×Ö±íʾ</entry> + <entry><literal>1</literal> µ½ <literal>31</literal></entry> + </row> + <row> + <entry><literal>"wday"</literal></entry> + <entry>ÐÇÆÚÖеڼ¸ÌìµÄÊý×Ö±íʾ</entry> + <entry><literal>0</literal>£¨±íʾÐÇÆÚÌ죩µ½ <literal>6</literal>£¨±íʾÐÇÆÚÁù£©</entry> + </row> + <row> + <entry><literal>"mon"</literal></entry> + <entry>Ô·ݵÄÊý×Ö±íʾ</entry> + <entry><literal>1</literal> µ½ <literal>12</literal></entry> + </row> + <row> + <entry><literal>"year"</literal></entry> + <entry>4 λÊý×Ö±íʾµÄÍêÕûÄê·Ý</entry> + <entry>ÀýÈ磺<literal>1999</literal> »ò <literal>2003</literal></entry> + </row> + <row> + <entry><literal>"yday"</literal></entry> + <entry>Ò»ÄêÖеڼ¸ÌìµÄÊý×Ö±íʾ</entry> + <entry><literal>0</literal> µ½ <literal>365</literal></entry> + </row> + <row> + <entry><literal>"weekday"</literal></entry> + <entry>ÐÇÆÚ¼¸µÄÍêÕûÎı¾±íʾ</entry> + <entry><literal>Sunday</literal> µ½ <literal>Saturday</literal></entry> + </row> + <row> + <entry><literal>"month"</literal></entry> + <entry>Ô·ݵÄÍêÕûÎı¾±íʾ</entry> + <entry><literal>January></literal> µ½ <literal>December</literal></entry> + </row> + <row> + <entry><literal>0</literal></entry> + <entry> + ×Ô´Ó Unix ¼ÍÔª¿ªÊ¼ÖÁ½ñµÄÃëÊý£¬ºÍ <function>time</function> + µÄ·µ»ØÖµÒÔ¼°ÓÃÓÚ <function>date</function> µÄÖµÀàËÆ¡£ + </entry> + <entry> + ϵͳÏà¹Ø£¬µäÐÍֵΪ´Ó <literal>-2147483648</literal> µ½ + <literal>2147483647</literal>¡£ + </entry> + </row> + </tbody> + </tgroup> + </table> + </para> + <para> + <example> + <title><function>getdate</function> Àý×Ó</title> + <programlisting role="php"> <![CDATA[ <?php $today = getdate(); print_r($today); ?> ]]> - </programlisting> - <para> - Êä³öÀàËÆÓÚ£º - </para> - <screen> + </programlisting> + &example.outputs.similar; + <screen> <![CDATA[ Array ( @@ -127,15 +123,15 @@ [0] => 1055901520 ) ]]> - </screen> - </example> - </para> - <para> - ²Î¼û <function>date</function>£¬<function>time</function> - ºÍ <function>setlocale</function>¡£ - </para> - </refsect1> - </refentry> + </screen> + </example> + </para> + <para> + ²Î¼û <function>date</function>£¬<function>time</function> + ºÍ <function>setlocale</function>¡£ + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/diff.php/phpdoc-zh/reference/datetime/functions/gettimeofday.xml?r1=1.2&r2=1.3&ty=u Index: phpdoc-zh/reference/datetime/functions/gettimeofday.xml diff -u phpdoc-zh/reference/datetime/functions/gettimeofday.xml:1.2 phpdoc-zh/reference/datetime/functions/gettimeofday.xml:1.3 --- phpdoc-zh/reference/datetime/functions/gettimeofday.xml:1.2 Sun Sep 29 23:07:33 2002 +++ phpdoc-zh/reference/datetime/functions/gettimeofday.xml Tue Aug 30 16:28:19 2005 @@ -1,45 +1,82 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <!-- $Author: dallas $ --> -<!-- EN-Revision: 1.2 Maintainer: dallas Status: ready --> - <refentry id="function.gettimeofday"> - <refnamediv> - <refname>gettimeofday</refname> - <refpurpose>È¡µÃµ±Ç°Ê±¼ä</refpurpose> - </refnamediv> - <refsect1> - <title>˵Ã÷</title> - <methodsynopsis> - <type>array</type><methodname>gettimeofday</methodname> - <void/> - </methodsynopsis> - <para> - ±¾º¯ÊýÊÇ gettimeofday(2) µÄ½Ó¿Ú¡£·µ»ØÒ»¸ö½áºÏÊý×飬°üº¬ÓÐϵͳµ÷Ó÷µ»ØµÄÊý¾Ý¡£ - <itemizedlist> - <listitem> - <simpara> - "sec" - ÃëÊý - </simpara> - </listitem> - <listitem> - <simpara> - "usec" - ΢ÃëÊý - </simpara> - </listitem> - <listitem> - <simpara> - "minuteswest" - ¸ñÁÖÍþÖÎÏòÎ÷µÄ·ÖÖÓÊý - </simpara> - </listitem> - <listitem> - <simpara> - "dsttime" - ÏÄÁîʱÐÞÕýµÄÀàÐÍ - </simpara> - </listitem> - </itemizedlist> - </para> - </refsect1> - </refentry> +<!-- EN-Revision: 1.6 Maintainer: dallas Status: ready --> +<refentry id="function.gettimeofday"> + <refnamediv> + <refname>gettimeofday</refname> + <refpurpose>È¡µÃµ±Ç°Ê±¼ä</refpurpose> + </refnamediv> + <refsect1> + <title>˵Ã÷</title> + <methodsynopsis> + <type>mixed</type><methodname>gettimeofday</methodname> + <methodparam choice="opt"><type>bool</type><parameter>return_float</parameter></methodparam> + </methodsynopsis> + <para> + ±¾º¯ÊýÊÇ gettimeofday(2) µÄ½Ó¿Ú¡£·µ»ØÒ»¸ö¹ØÁªÊý×飬°üº¬ÓÐϵͳµ÷Ó÷µ»ØµÄÊý¾Ý¡£ + </para> + <para> + ×Ô PHP 5.1.0 ÆðÓиö¿ÉÑ¡²ÎÊý + <parameter>return_float</parameter>£¬µ±ÆäÉèΪ + &true; ʱ£¬<function>gettimeofday</function> + »á·µ»ØÒ»¸ö¸¡µãÊý¡£ + </para> + <para> + Êý×éÖеļüΪ£º + <itemizedlist> + <listitem> + <simpara> + "sec" - ×Ô Unix ¼ÍÔªÆðµÄÃëÊý + </simpara> + </listitem> + <listitem> + <simpara> + "usec" - ΢ÃëÊý + </simpara> + </listitem> + <listitem> + <simpara> + "minuteswest" - ¸ñÁÖÍþÖÎÏòÎ÷µÄ·ÖÖÓÊý + </simpara> + </listitem> + <listitem> + <simpara> + "dsttime" - ÏÄÁîʱÐÞÕýµÄÀàÐÍ + </simpara> + </listitem> + </itemizedlist> + </para> + <para> + <example> + <title><function>gettimeofday</function> example</title> + <programlisting role="php"> +<![CDATA[ +<?php +print_r(gettimeofday()); + +echo gettimeofday(true); +?> +]]> + </programlisting> + &example.outputs.similar; + <screen> +<![CDATA[ +Array +( + [sec] => 1073504408 + [usec] => 238215 + [minuteswest] => 0 + [dsttime] => 1 +) + +1073504408.23910 +]]> + </screen> + </example> + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/diff.php/phpdoc-zh/reference/datetime/functions/gmdate.xml?r1=1.6&r2=1.7&ty=u Index: phpdoc-zh/reference/datetime/functions/gmdate.xml diff -u phpdoc-zh/reference/datetime/functions/gmdate.xml:1.6 phpdoc-zh/reference/datetime/functions/gmdate.xml:1.7 --- phpdoc-zh/reference/datetime/functions/gmdate.xml:1.6 Mon May 12 01:23:49 2003 +++ phpdoc-zh/reference/datetime/functions/gmdate.xml Tue Aug 30 16:28:19 2005 @@ -1,59 +1,48 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.6 $ --> +<!-- $Revision: 1.7 $ --> <!-- $Author: dallas $ --> -<!-- EN-Revision: 1.7 Maintainer: dallas Status: ready --> - <refentry id="function.gmdate"> - <refnamediv> - <refname>gmdate</refname> - <refpurpose>¸ñʽ»¯Ò»¸ö GMT/UTC ÈÕÆÚ£¯Ê±¼ä</refpurpose> - </refnamediv> - <refsect1> - <title>˵Ã÷</title> - <methodsynopsis> - <type>string</type><methodname>gmdate</methodname> - <methodparam><type>string</type><parameter>format</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>timestamp</parameter></methodparam> - </methodsynopsis> - <para> - ͬ <function>date</function> - º¯ÊýÍêȫһÑù£¬Ö»³ýÁË·µ»ØµÄʱ¼äÊǸñÁÖÍþÖαê׼ʱ£¨GMT£©¡£ÀýÈçµ±ÔÚÖйú£¨GMT - +0800£©ÔËÐÐÒÔϳÌÐòʱ£¬µÚÒ»ÐÐÏÔʾ¡°Jan 01 2000 00:00:00¡±¶øµÚ¶þÐÐÏÔʾ¡°Dec - 31 1999 16:00:00¡±¡£ - <example> - <title><function>gmdate</function> Àý×Ó</title> - <programlisting role="php"> +<!-- EN-Revision: 1.10 Maintainer: dallas Status: ready --> +<refentry id="function.gmdate"> + <refnamediv> + <refname>gmdate</refname> + <refpurpose>¸ñʽ»¯Ò»¸ö GMT/UTC ÈÕÆÚ£¯Ê±¼ä</refpurpose> + </refnamediv> + <refsect1> + <title>˵Ã÷</title> + <methodsynopsis> + <type>string</type><methodname>gmdate</methodname> + <methodparam><type>string</type><parameter>format</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>timestamp</parameter></methodparam> + </methodsynopsis> + <para> + ͬ <function>date</function> + º¯ÊýÍêȫһÑù£¬Ö»³ýÁË·µ»ØµÄʱ¼äÊǸñÁÖÍþÖαê׼ʱ£¨GMT£©¡£ÀýÈçµ±ÔÚÖйú£¨GMT + +0800£©ÔËÐÐÒÔϳÌÐòʱ£¬µÚÒ»ÐÐÏÔʾ¡°Jan 01 2000 00:00:00¡±¶øµÚ¶þÐÐÏÔʾ¡°Dec + 31 1999 16:00:00¡±¡£ + <example> + <title><function>gmdate</function> Àý×Ó</title> + <programlisting role="php"> <![CDATA[ <?php -echo date ("M d Y H:i:s", mktime (0,0,0,1,1,2000)); -echo gmdate ("M d Y H:i:s", mktime (0,0,0,1,1,2000)); +echo date("M d Y H:i:s", mktime (0,0,0,1,1,2000)); +echo gmdate("M d Y H:i:s", mktime (0,0,0,1,1,2000)); ?> ]]> - </programlisting> - </example> - </para> - <note> - <para> - ÔÚ Microsoft Windows - ϵÁеIJÙ×÷ϵͳÖÐʵÏÖ±¾º¯ÊýµÄϵͳ¿âÊÇ»µµÄ£¬Òò´Ë - <function>gmdate</function> ²»Ö§³Ö¸ºµÄ - <parameter>timestamp</parameter> ²ÎÊýÖµ¡£Ï¸½Ú¼û´íÎ󱨸棺<ulink - url="&url.php.bugs;22620">#22620</ulink>£¬<ulink - url="&url.php.bugs;22457">#22457</ulink> ºÍ <ulink - url="&url.php.bugs;14391">#14391</ulink>¡£ - </para> - <para> - ´ËÎÊÌâ²»»á³öÏÖÓÚ Unix/Linux - ²Ù×÷ϵͳ£¬¸ÃϵͳϵÄϵͳ¿â»á°´ÕÕÔ¤ÆÚ½á¹ûÔË×÷¡£ - </para> - <para> - PHP ÎÞ·¨ÐÞ¸´»µµÄϵͳ¿â¡£ÒªÐÞÕýÓë´ËÀàËÆµÄÎÊÌâÇëÁªÏµ²Ù×÷ϵͳ¹©Ó¦ÉÌ¡£ - </para> - </note> - <para> - ²Î¼û <function>date</function>£¬<function>mktime</function>£¬<function>gmmktime</function> ºÍ <function>strftime</function>¡£ - </para> - </refsect1> - </refentry> + </programlisting> + </example> + </para> + <note> + <para> + ÔÚ PHP 5.1.0 ֮ǰ£¬¸ºµÄʱ¼ä´Á£¨1970 Äê֮ǰµÄÈÕÆÚ£©ÔÚijЩϵͳÏ£¨ÀýÈç + Windows£©²»Äܹ¤×÷¡£ + </para> + </note> + <para> + ²Î¼û <function>date</function>£¬<function>mktime</function>£¬<function>gmmktime</function> + ºÍ <function>strftime</function>¡£ + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/diff.php/phpdoc-zh/reference/datetime/functions/gmmktime.xml?r1=1.4&r2=1.5&ty=u Index: phpdoc-zh/reference/datetime/functions/gmmktime.xml diff -u phpdoc-zh/reference/datetime/functions/gmmktime.xml:1.4 phpdoc-zh/reference/datetime/functions/gmmktime.xml:1.5 --- phpdoc-zh/reference/datetime/functions/gmmktime.xml:1.4 Sun Apr 20 02:22:53 2003 +++ phpdoc-zh/reference/datetime/functions/gmmktime.xml Tue Aug 30 16:28:19 2005 @@ -1,33 +1,65 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <!-- $Author: dallas $ --> -<!-- EN-Revision: 1.3 Maintainer: dallas Status: ready --> - <refentry id="function.gmmktime"> - <refnamediv> - <refname>gmmktime</refname> - <refpurpose>È¡µÃ GMT ÈÕÆÚµÄ UNIX ʱ¼ä´Á</refpurpose> - </refnamediv> - <refsect1> - <title>˵Ã÷</title> - <methodsynopsis> - <type>int</type><methodname>gmmktime</methodname> - <methodparam choice="opt"><type>int</type><parameter>hour</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>minute</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>second</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>month</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>day</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>year</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>is_dst</parameter></methodparam> - </methodsynopsis> - <para> - ºÍ <function>mktime</function> ÍêȫһÑù£¬Ö»³ýÁË·µ»ØÖµÊǸñÁÖÍþÖαê׼ʱµÄʱ¼ä´Á¡£ - </para> - <para> - ºÍ <function>mktime</function> - Ò»Ñù£¬²ÎÊý¿ÉÒÔ´ÓÓÒµ½×óÒÀ´Î¿Õ×Å£¬¿Õ×ŵIJÎÊý»á±»ÉèΪÏàÓ¦µÄµ±Ç° GMT Öµ¡£ - </para> - </refsect1> - </refentry> +<!-- EN-Revision: 1.9 Maintainer: dallas Status: ready --> +<refentry id="function.gmmktime"> + <refnamediv> + <refname>gmmktime</refname> + <refpurpose>È¡µÃ GMT ÈÕÆÚµÄ UNIX ʱ¼ä´Á</refpurpose> + </refnamediv> + <refsect1> + <title>˵Ã÷</title> + <methodsynopsis> + <type>int</type><methodname>gmmktime</methodname> + <methodparam choice="opt"><type>int</type><parameter>hour</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>minute</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>second</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>month</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>day</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>year</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>is_dst</parameter></methodparam> + </methodsynopsis> + <para> + ºÍ <function>mktime</function> ÍêȫһÑù£¬Ö»³ýÁË·µ»ØÖµÊǸñÁÖÍþÖαê׼ʱµÄʱ¼ä´Á¡£ + </para> + <para> + ²ÎÊý×ÜÊDZíʾ GMT ÈÕÆÚ£¬Òò´Ë <parameter>is_dst</parameter> + ¶Ô½á¹ûûÓÐÓ°Ïì¡£ + </para> + <para> + ºÍ <function>mktime</function> + Ò»Ñù£¬²ÎÊý¿ÉÒÔ´ÓÓÒµ½×óÒÀ´Î¿Õ×Å£¬¿Õ×ŵIJÎÊý»á±»ÉèΪÏàÓ¦µÄµ±Ç° GMT Öµ¡£ + </para> + <note> + <para> + ×Ô 5.1.0 Æð£¬<parameter>is_dst</parameter> ²ÎÊý±»·ÏÆú¡£Òò´ËÓ¦¸ÃÓÃеÄÊ±Çø´¦ÀíÌØÐÔ¡£ + </para> + </note> + <para> + <note> + <simpara> + <function>gmmktime</function> ÄÚ²¿Ê¹ÓÃÁË + <function>mktime</function>£¬Òò´ËÖ»ÓÐת»»³É±¾µØÊ±¼äÒ²ºÏ·¨µÄʱ¼ä²ÅÄÜÓÃÔÚÆäÖС£ + so only times valid in derived local time can be used. + </simpara> + </note> + <example> + <title><function>gmmktime</function> ÔÚ Windows Öеı߽ç</title> + <programlisting role="php"> +<![CDATA[ +<?php +gmmktime(0, 0, 0, 1, 1, 1970); // ÔÚ GMT ºÍÎ÷·½ºÏ·¨£¬ÔÚ¶«·½²»ºÏ·¨ +?> +]]> + </programlisting> + </example> + </para> + <para> + ²Î¼û <function>mktime</function>£¬<function>date</function> + ºÍ <function>time</function>¡£ + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/diff.php/phpdoc-zh/reference/datetime/functions/gmstrftime.xml?r1=1.4&r2=1.5&ty=u Index: phpdoc-zh/reference/datetime/functions/gmstrftime.xml diff -u phpdoc-zh/reference/datetime/functions/gmstrftime.xml:1.4 phpdoc-zh/reference/datetime/functions/gmstrftime.xml:1.5 --- phpdoc-zh/reference/datetime/functions/gmstrftime.xml:1.4 Sun Apr 20 02:22:53 2003 +++ phpdoc-zh/reference/datetime/functions/gmstrftime.xml Tue Aug 30 16:28:19 2005 @@ -1,44 +1,44 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <!-- $Author: dallas $ --> -<!-- EN-Revision: 1.5 Maintainer: dallas Status: ready --> - <refentry id="function.gmstrftime"> - <refnamediv> - <refname>gmstrftime</refname> - <refpurpose> - ¸ù¾ÝÇøÓòÉèÖøñʽ»¯ GMT/UTC ʱ¼ä£¯ÈÕÆÚ - </refpurpose> - </refnamediv> - <refsect1> - <title>˵Ã÷</title> - <methodsynopsis> - <type>string</type><methodname>gmstrftime</methodname> - <methodparam><type>string</type><parameter>format</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>timestamp</parameter></methodparam> - </methodsynopsis> - <para> - ºÍ <function>strftime</function> - µÄÐÐΪÏàͬ£¬Ö»³ýÁË·µ»ØÊ±¼äÊǸñÁÖÍþÖαê׼ʱ£¨GMT£©¡£ÀýÈ磬µ±ÔÚ¶«²¿±ê׼ʱ£¨EST£¬GMT - -500£©ÔËÐÐʱ£¬ÏÂÃæµÚÒ»ÐÐÏÔʾ¡°Dec 31 1998 20:00:00¡±£¬¶øµÚ¶þÐÐÏÔʾ¡°Jan 01 1999 - 01:00:00¡±¡£ - <example> - <title><function>gmstrftime</function> Àý×Ó</title> - <programlisting role="php"> +<!-- EN-Revision: 1.8 Maintainer: dallas Status: ready --> +<refentry id="function.gmstrftime"> + <refnamediv> + <refname>gmstrftime</refname> + <refpurpose> + ¸ù¾ÝÇøÓòÉèÖøñʽ»¯ GMT/UTC ʱ¼ä£¯ÈÕÆÚ + </refpurpose> + </refnamediv> + <refsect1> + <title>˵Ã÷</title> + <methodsynopsis> + <type>string</type><methodname>gmstrftime</methodname> + <methodparam><type>string</type><parameter>format</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>timestamp</parameter></methodparam> + </methodsynopsis> + <para> + ºÍ <function>strftime</function> + µÄÐÐΪÏàͬ£¬Ö»³ýÁË·µ»ØÊ±¼äÊǸñÁÖÍþÖαê׼ʱ£¨GMT£©¡£ÀýÈ磬µ±ÔÚ¶«²¿±ê׼ʱ£¨EST£¬GMT + -500£©ÔËÐÐʱ£¬ÏÂÃæµÚÒ»ÐÐÏÔʾ¡°Dec 31 1998 20:00:00¡±£¬¶øµÚ¶þÐÐÏÔʾ¡°Jan 01 1999 + 01:00:00¡±¡£ + <example> + <title><function>gmstrftime</function> Àý×Ó</title> + <programlisting role="php"> <![CDATA[ <?php -setlocale (LC_TIME, 'en_US'); -echo strftime ("%b %d %Y %H:%M:%S", mktime (20,0,0,12,31,98))."\n"; -echo gmstrftime ("%b %d %Y %H:%M:%S", mktime (20,0,0,12,31,98))."\n"; +setlocale(LC_TIME, 'en_US'); +echo strftime("%b %d %Y %H:%M:%S", mktime (20,0,0,12,31,98))."\n"; +echo gmstrftime("%b %d %Y %H:%M:%S", mktime (20,0,0,12,31,98))."\n"; ?> ]]> - </programlisting> - </example> - </para> - <para> - ²Î¼û <function>strftime</function>¡£ - </para> - </refsect1> - </refentry> + </programlisting> + </example> + </para> + <para> + ²Î¼û <function>strftime</function>¡£ + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/diff.php/phpdoc-zh/reference/datetime/functions/localtime.xml?r1=1.3&r2=1.4&ty=u Index: phpdoc-zh/reference/datetime/functions/localtime.xml diff -u phpdoc-zh/reference/datetime/functions/localtime.xml:1.3 phpdoc-zh/reference/datetime/functions/localtime.xml:1.4 --- phpdoc-zh/reference/datetime/functions/localtime.xml:1.3 Sun Apr 20 02:22:53 2003 +++ phpdoc-zh/reference/datetime/functions/localtime.xml Tue Aug 30 16:28:19 2005 @@ -1,82 +1,128 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.3 $ --> +<!-- $Revision: 1.4 $ --> <!-- $Author: dallas $ --> -<!-- EN-Revision: 1.3 Maintainer: dallas Status: ready --> - <refentry id="function.localtime"> - <refnamediv> - <refname>localtime</refname> - <refpurpose>È¡µÃ±¾µØÊ±¼ä</refpurpose> - </refnamediv> - <refsect1> - <title>˵Ã÷</title> - <methodsynopsis> - <type>array</type><methodname>localtime</methodname> - <methodparam choice="opt"><type>int</type><parameter> - timestamp - </parameter></methodparam> - <methodparam choice="opt"><type>bool</type><parameter> - is_associative - </parameter></methodparam> - </methodsynopsis> - <para> - <function>localtime</function> º¯Êý·µ»ØÒ»¸öÊý×飬Æä½á¹¹ºÍ - C º¯Êýµ÷Ó÷µ»ØµÄÍêȫһÑù¡£<function>localtime</function> - µÄµÚÒ»¸ö²ÎÊýÊÇʱ¼ä´Á£¬Èç¹ûûÓиø³öÔòʹÓÃ´Ó - <function>time</function> ·µ»ØµÄµ±Ç°Ê±¼ä¡£µÚ¶þ¸ö²ÎÊýÊÇ - <parameter>is_associative</parameter>£¬Èç¹ûÉèΪ 0 - »òδÌṩÔò·µ»ØµÄÊÇÆÕͨµÄÊý×ÖË÷ÒýÊý×é¡£Èç¹û¸Ã²ÎÊýÉèΪ 1 Ôò - <function>localtime</function> º¯Êý·µ»Ø°üº¬ÓÐËùÓÐ´Ó - C µÄ localtime º¯Êýµ÷ÓÃËù·µ»ØµÄ²»Í¬µ¥ÔªµÄ½áºÏÊý×é¡£½áºÏÊý×éÖв»Í¬µÄ¼üÃûΪ£º - <itemizedlist> - <listitem> - <simpara> - "tm_sec" - ÃëÊý - </simpara> - </listitem> - <listitem> - <simpara> - "tm_min" - ·ÖÖÓÊý - </simpara> - </listitem> - <listitem> - <simpara> - "tm_hour" - Сʱ - </simpara> - </listitem> - <listitem> - <simpara> - "tm_mday" - Ô·ÝÖеĵڼ¸ÈÕ - </simpara> - </listitem> - <listitem> - <simpara> - "tm_mon" - Äê·ÝÖеĵڼ¸¸öÔ£¬´Ó 0 ¿ªÊ¼±íʾһÔ - </simpara> - </listitem> - <listitem> - <simpara> - "tm_year" - Äê·Ý£¬´Ó 1900 ¿ªÊ¼ - </simpara> - </listitem> - <listitem> - <simpara> - "tm_wday" - ÐÇÆÚÖеĵڼ¸Ìì - </simpara> - </listitem> - <listitem> - <simpara> - "tm_yday" - Ò»ÄêÖеĵڼ¸Ìì - </simpara> - </listitem> - <listitem> - <simpara> - "tm_isdst" - ÏÄÁîʱµ±Ç°ÊÇ·ñÉúЧ - </simpara> - </listitem> - </itemizedlist> - </para> - </refsect1> - </refentry> +<!-- EN-Revision: 1.7 Maintainer: dallas Status: ready --> +<refentry id="function.localtime"> + <refnamediv> + <refname>localtime</refname> + <refpurpose>È¡µÃ±¾µØÊ±¼ä</refpurpose> + </refnamediv> + <refsect1> + <title>˵Ã÷</title> + <methodsynopsis> + <type>array</type><methodname>localtime</methodname> + <methodparam choice="opt"><type>int</type><parameter>timestamp</parameter></methodparam> + <methodparam choice="opt"><type>bool</type><parameter>is_associative</parameter></methodparam> + </methodsynopsis> + <para> + <function>localtime</function> º¯Êý·µ»ØÒ»¸öÊý×飬Æä½á¹¹ºÍ + C º¯Êýµ÷Ó÷µ»ØµÄÍêȫһÑù¡£<function>localtime</function> + µÄµÚÒ»¸ö²ÎÊýÊÇʱ¼ä´Á£¬Èç¹ûûÓиø³öÔòʹÓÃ´Ó + <function>time</function> ·µ»ØµÄµ±Ç°Ê±¼ä¡£µÚ¶þ¸ö²ÎÊýÊÇ + <parameter>is_associative</parameter>£¬Èç¹ûÉèΪ &false; + »òδÌṩÔò·µ»ØµÄÊÇÆÕͨµÄÊý×ÖË÷ÒýÊý×é¡£Èç¹û¸Ã²ÎÊýÉèΪ &true; Ôò + <function>localtime</function> º¯Êý·µ»Ø°üº¬ÓÐËùÓÐ´Ó + C µÄ localtime º¯Êýµ÷ÓÃËù·µ»ØµÄ²»Í¬µ¥ÔªµÄ¹ØÁªÊý×é¡£¹ØÁªÊý×éÖв»Í¬µÄ¼üÃûΪ£º + <itemizedlist> + <listitem> + <simpara> + "tm_sec" - ÃëÊý + </simpara> + </listitem> + <listitem> + <simpara> + "tm_min" - ·ÖÖÓÊý + </simpara> + </listitem> + <listitem> + <simpara> + "tm_hour" - Сʱ + </simpara> + </listitem> + <listitem> + <simpara> + "tm_mday" - Ô·ÝÖеĵڼ¸ÈÕ + </simpara> + </listitem> + <listitem> + <simpara> + "tm_mon" - Äê·ÝÖеĵڼ¸¸öÔ£¬´Ó 0 ¿ªÊ¼±íʾһÔ + </simpara> + </listitem> + <listitem> + <simpara> + "tm_year" - Äê·Ý£¬´Ó 1900 ¿ªÊ¼ + </simpara> + </listitem> + <listitem> + <simpara> + "tm_wday" - ÐÇÆÚÖеĵڼ¸Ìì + </simpara> + </listitem> + <listitem> + <simpara> + "tm_yday" - Ò»ÄêÖеĵڼ¸Ìì + </simpara> + </listitem> + <listitem> + <simpara> + "tm_isdst" - ÏÄÁîʱµ±Ç°ÊÇ·ñÉúЧ + </simpara> + </listitem> + </itemizedlist> + </para> + <note> + <simpara> + ÔÂ·Ý´Ó 0£¨Ò»Ô£©µ½ 11£¨Ê®¶þÔ£©£¬ÐÇÆÚÊý´Ó 0£¨ÐÇÆÚÌ죩µ½ 6£¨ÐÇÆÚÁù£©¡£ + </simpara> + </note> + <para> + <example> + <title><function>time</function> Àý×Ó</title> + <programlisting role="php"> +<![CDATA[ +<?php +$localtime = localtime(); +$localtime_assoc = localtime(time(), true); +print_r($localtime); +print_r($localtime_assoc); +?> +]]> + </programlisting> + &example.outputs.similar; + <screen> +<![CDATA[ +Array +( + [0] => 24 + [1] => 3 + [2] => 19 + [3] => 3 + [4] => 3 + [5] => 105 + [6] => 0 + [7] => 92 + [9] => 1 +) + +Array +( + [tm_sec] => 24 + [tm_min] => 3 + [tm_hour] => 19 + [tm_mday] => 3 + [tm_mon] => 3 + [tm_year] => 105 + [tm_wday] => 0 + [tm_yday] => 92 + [tm_isdst] => 1 +) +]]> + </screen> + </example> + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/diff.php/phpdoc-zh/reference/datetime/functions/microtime.xml?r1=1.3&r2=1.4&ty=u Index: phpdoc-zh/reference/datetime/functions/microtime.xml diff -u phpdoc-zh/reference/datetime/functions/microtime.xml:1.3 phpdoc-zh/reference/datetime/functions/microtime.xml:1.4 --- phpdoc-zh/reference/datetime/functions/microtime.xml:1.3 Sun Apr 20 02:22:53 2003 +++ phpdoc-zh/reference/datetime/functions/microtime.xml Tue Aug 30 16:28:19 2005 @@ -1,56 +1,71 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.3 $ --> +<!-- $Revision: 1.4 $ --> <!-- $Author: dallas $ --> -<!-- EN-Revision: 1.3 Maintainer: dallas Status: ready --> - <refentry id="function.microtime"> - <refnamediv> - <refname>microtime</refname> - <refpurpose> - ·µ»Øµ±Ç° UNIX ʱ¼ä´ÁºÍ΢ÃëÊý</refpurpose> - </refnamediv> - <refsect1> - <title>˵Ã÷</title> - <methodsynopsis> - <type>string</type><methodname>microtime</methodname> - <void/> - </methodsynopsis> - <para> - ·µ»Ø¸ñʽΪ¡°msec sec¡±µÄ×Ö·û´®£¬ÆäÖÐ sec Êǵ±Ç°µÄ Unix - ʱ¼ä´Á£¬msec ÊÇ΢Ã벿·Ö¡£±¾º¯Êý½öÔÚÖ§³Ö gettimeofday() - ϵͳµ÷ÓõIJÙ×÷ϵͳÏ¿ÉÓᣠ- </para> - <para> - ×Ö·û´®µÄÁ½²¿·Ö¶¼ÊÇÒÔÃëΪµ¥Î»·µ»ØµÄ¡£ - <example> - <title><function>microtime</function> Àý×Ó</title> - <programlisting role="php"> +<!-- EN-Revision: 1.13 Maintainer: dallas Status: ready --> +<refentry id="function.microtime"> + <refnamediv> + <refname>microtime</refname> + <refpurpose>·µ»Øµ±Ç° Unix ʱ¼ä´ÁºÍ΢ÃëÊý</refpurpose> + </refnamediv> + <refsect1> + <title>˵Ã÷</title> + <methodsynopsis> + <type>mixed</type><methodname>microtime</methodname> + <methodparam choice="opt"><type>bool</type><parameter>get_as_float</parameter></methodparam> + </methodsynopsis> + <para> + <function>microtime</function> µ±Ç° Unix + ʱ¼ä´ÁÒÔ¼°Î¢ÃëÊý¡£±¾º¯Êý½öÔÚÖ§³Ö gettimeofday() + ϵͳµ÷ÓõIJÙ×÷ϵͳÏ¿ÉÓᣠ+ </para> + <para> + Èç¹ûµ÷ÓÃʱ²»´ø¿ÉÑ¡²ÎÊý£¬±¾º¯ÊýÒÔ "msec sec" + µÄ¸ñʽ·µ»ØÒ»¸ö×Ö·û´®£¬ÆäÖÐ sec ÊÇ×Ô Unix ¼ÍÔª£¨0:00:00 January 1, + 1970 GMT£©Æðµ½ÏÖÔÚµÄÃëÊý£¬msec ÊÇ΢Ã벿·Ö¡£×Ö·û´®µÄÁ½²¿·Ö¶¼ÊÇÒÔÃëΪµ¥Î»·µ»ØµÄ¡£ + </para> + <para> + Èç¹û¸ø³öÁË <parameter>get_as_float</parameter> ²ÎÊý²¢ÇÒÆäÖµµÈ¼ÛÓÚ + &true;£¬<function>microtime</function> ½«·µ»ØÒ»¸ö¸¡µãÊý¡£ + </para> + <note> + <simpara> + <parameter>get_as_float</parameter> ²ÎÊýÊÇ PHP 5.0.0 мӵġ£ + </simpara> + </note> + <para> + <example> + <title>Óà <function>microtime</function> ¶Ô½Å±¾µÄÔËÐмÆÊ±</title> + <programlisting role="php"> <![CDATA[ <?php -function getmicrotime(){ - list($usec, $sec) = explode(" ",microtime()); - return ((float)$usec + (float)$sec); - } +/** + * Simple function to replicate PHP 5 behaviour + */ +function microtime_float() +{ + list($usec, $sec) = explode(" ", microtime()); + return ((float)$usec + (float)$sec); +} -$time_start = getmicrotime(); - -for ($i=0; $i < 1000; $i++){ - //do nothing, 1000 times - } +$time_start = microtime_float(); -$time_end = getmicrotime(); +// Sleep for a while +usleep(100); + +$time_end = microtime_float(); $time = $time_end - $time_start; -echo "Did nothing in $time seconds"; +echo "Did nothing in $time seconds\n"; ?> ]]> - </programlisting> - </example> - </para> - <para> - ²Î¼û <function>time</function>¡£ - </para> - </refsect1> - </refentry> + </programlisting> + </example> + </para> + <para> + ²Î¼û <function>time</function>¡£ + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/diff.php/phpdoc-zh/reference/datetime/functions/mktime.xml?r1=1.4&r2=1.5&ty=u Index: phpdoc-zh/reference/datetime/functions/mktime.xml diff -u phpdoc-zh/reference/datetime/functions/mktime.xml:1.4 phpdoc-zh/reference/datetime/functions/mktime.xml:1.5 --- phpdoc-zh/reference/datetime/functions/mktime.xml:1.4 Sun Apr 20 02:22:53 2003 +++ phpdoc-zh/reference/datetime/functions/mktime.xml Tue Aug 30 16:28:19 2005 @@ -1,108 +1,221 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <!-- $Author: dallas $ --> -<!-- EN-Revision: 1.5 Maintainer: dallas Status: ready --> - <refentry id="function.mktime"> - <refnamediv> - <refname>mktime</refname> - <refpurpose>È¡µÃÒ»¸öÈÕÆÚµÄ UNIX ʱ¼ä´Á</refpurpose> - </refnamediv> - <refsect1> - <title>˵Ã÷</title> - <methodsynopsis> - <type>int</type><methodname>mktime</methodname> - <methodparam choice="opt"><type>int</type><parameter>hour</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>minute</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>second</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>month</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>day</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>year</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>is_dst</parameter></methodparam> - </methodsynopsis> - <para> - <emphasis>¾¯¸æ£º</emphasis>×¢Òâ²ÎÊýµÄÆæ¹Ö˳Ðò£¬ÕâºÍ±ê×¼µÄ UNIX mktime() - µ÷ÓÃÖеIJÎÊý˳Ðò²»Í¬¡£Ôڽű¾¾³£»á»ìÏýÕâЩֵ¶ø³ö´í¡£ - <!-- ²»Ì«ºÃ·£¬ÔÎÄÁô×Å¡£ - Note the strange order of - arguments, which differs from the order of arguments in a regular - UNIX mktime() call and which does not lend itself well to leaving - out parameters from right to left (see below). It is a common - error to mix these values up in a script. - --> - </para> - <para> - ¸ù¾Ý¸ø³öµÄ²ÎÊý·µ»Ø Unix ʱ¼ä´Á¡£Ê±¼ä´ÁÊÇÒ»¸ö³¤ÕûÊý£¬°üº¬ÁË´Ó - Unix мÍÔª£¨1970 Äê 1 Ô 1 ÈÕ£©µ½¸ø¶¨Ê±¼äµÄÃëÊý¡£ - </para> - <para> - ²ÎÊý¿ÉÒÔ´ÓÓÒÏò×óÊ¡ÂÔ£¬ÈκÎÊ¡ÂԵIJÎÊý»á±»ÉèÖóɱ¾µØÈÕÆÚºÍʱ¼äµÄµ±Ç°Öµ¡£ - </para> - <para> - <parameter>is_dst</parameter> ÔÚÏÄÁîʱ¿ÉÒÔ±»ÉèΪ 1£¬Èç¹û²»ÊÇÔòÉèΪ - 0£¬»òÕß²»ÖªµÀÊÇ·ñΪÏÄÁîʱµÄ»°ÉèΪ -1£¨Ä¬ÈÏÖµ£©¡£Èç¹û²»ÖªµÀ£¬PHP - »á³¢ÊÔ×Ô¼ºÅжϡ£Õâ¿ÉÄÜ»á²úÉúδԤÆÚ£¨µ«²»ÊÇ´íÎ󣩵Ľá¹û¡£ +<!-- EN-Revision: 1.20 Maintainer: dallas Status: ready --> +<refentry id="function.mktime"> + <refnamediv> + <refname>mktime</refname> + <refpurpose>È¡µÃÒ»¸öÈÕÆÚµÄ Unix ʱ¼ä´Á</refpurpose> + </refnamediv> + + <refsect1 role="description"> + &reftitle.description; + <methodsynopsis> + <type>int</type><methodname>mktime</methodname> + <methodparam choice="opt"><type>int</type><parameter>hour</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>minute</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>second</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>month</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>day</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>year</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>is_dst</parameter></methodparam> + </methodsynopsis> + <para> + ¸ù¾Ý¸ø³öµÄ²ÎÊý·µ»Ø Unix ʱ¼ä´Á¡£Ê±¼ä´ÁÊÇÒ»¸ö³¤ÕûÊý£¬°üº¬ÁË´Ó + Unix ¼ÍÔª£¨January 1 1970 00:00:00 GMT£©µ½¸ø¶¨Ê±¼äµÄÃëÊý¡£ + </para> + <para> + ²ÎÊý¿ÉÒÔ´ÓÓÒÏò×óÊ¡ÂÔ£¬ÈκÎÊ¡ÂԵIJÎÊý»á±»ÉèÖóɱ¾µØÈÕÆÚºÍʱ¼äµÄµ±Ç°Öµ¡£ + </para> + </para> + </refsect1> + + <refsect1 role="parameters"> + &reftitle.parameters; + <para> + <variablelist> + <varlistentry> + <term><parameter>hour</parameter></term> + <listitem> + <para> + СʱÊý¡£ + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>minute</parameter></term> + <listitem> + <para> + ·ÖÖÓÊý¡£ + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>second</parameter></term> + <listitem> + <para> + ÃëÊý£¨Ò»·ÖÖÓÖ®ÄÚ£©¡£ + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>month</parameter></term> + <listitem> + <para> + Ô·ÝÊý¡£ + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>day</parameter></term> + <listitem> + <para> + ÌìÊý¡£ + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>year</parameter></term> + <listitem> + <para> + Äê·ÝÊý£¬¿ÉÒÔÊÇÁ½Î»»òËÄλÊý×Ö£¬0-69 ¶ÔÓ¦ÓÚ 2000-2069£¬70-100 + ¶ÔÓ¦ÓÚ 1970-2000¡£ÔÚÈç½ñϵͳÖÐÆÕ±é°Ñ time_t ×÷Ϊһ¸ö 32 + λÓзûºÅÕûÊýµÄÇé¿öÏ£¬<parameter>year</parameter> + µÄºÏ·¨·¶Î§ÊÇ 1901 µ½ 2038 Ö®¼ä£¬²»¹ý´ËÏÞÖÆ×Ô + PHP 5.1.0 ÆðÒѱ»¿Ë·þÁË¡£ + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>is_dst</parameter></term> + <listitem> + <para> + ±¾²ÎÊý¿ÉÒÔÉèΪ 1£¬±íʾÕý´¦ÓÚÏÄÊ±ÖÆÊ±¼ä£¨DST£©£¬0 + ±íʾ²»ÊÇÏÄÊ±ÖÆ£¬»òÕß -1£¨Ä¬ÈÏÖµ£©±íʾ²»ÖªµÀÊÇ·ñÊÇÏÄÊ±ÖÆ¡£Èç¹ûδ֪£¬PHP + »á³¢ÊÔ×Ô¼º¸ãÃ÷°×¡£Õâ¿ÉÄܲúÉú²»¿ÉÔ¤Öª£¨µ«²¢·Ç²»ÕýÈ·£©µÄ½á¹û¡£Èç¹û + PHP ÔËÐеÄϵͳÖÐÆôÓÃÁË DST »òÕß <parameter>is_dst</parameter> + ÉèΪ 1£¬Ä³Ð©Ê±¼äÊÇÎÞЧµÄ¡£ÀýÈç DST ×Ô 2:00 ÉúЧ£¬ÔòËùÓд¦ÓÚ + 2:00 µ½ 3:00 Ö®¼äµÄʱ¼ä¶¼ÎÞЧ£¬<function>mktime</function> + »á·µ»ØÒ»¸ö䶨Ò壨ͨ³£Îª¸º£©µÄÖµ¡£Ä³Ð©ÏµÍ³£¨ÀýÈç + Solaris 8£©µÄ DST ÔÚÎçÒ¹ÉúЧ£¬Ôò DST ÉúЧµ±ÌìµÄ 0:30 + »á±»¼ÆËãΪǰһÌìµÄ 23:30¡£ + </para> + <note> + <para> + ×Ô PHP 5.1.0 Æð£¬±¾²ÎÊýÒѱ»·ÏÆú¡£Ó¦¸ÃʹÓÃеÄÊ±Çø´¦ÀíÌØÐÔÀ´Ìæ´ú¡£ + </para> + </note> + </listitem> + </varlistentry> + </variablelist> + </para> + </refsect1> + + + <refsect1 role="returnvalues"> + &reftitle.returnvalues; + <para> + <function>mktime</function> ¸ù¾Ý¸ø³öµÄ²ÎÊý·µ»Ø Unix + ʱ¼ä´Á¡£Èç¹û²ÎÊý·Ç·¨£¨ÀýÈçÄ꣬Ô£¬ÈÕ¶¼ÊÇÁ㣩£¬±¾º¯Êý·µ»Ø + &false;£¨ÔÚ PHP 5.1 ֮ǰ·µ»Ø <literal>-1</literal>£©¡£ + </para> + </refsect1> + + <refsect1 role="changelog"> + &reftitle.changelog; + <para> + <informaltable> + <tgroup cols="2"> + <thead> + <row> + <entry>&Version;</entry> + <entry>&Description;</entry> + </row> + </thead> + <tbody> + <row> + <entry>3.0.10</entry> + <entry>¼ÓÈëÁË <parameter>is_dst</parameter> ²ÎÊý</entry> + </row> + <row> + <entry>5.1.0</entry> + <entry> + <parameter>is_dst</parameter> ²ÎÊý±»·ÏÆú¡£³ö´íʱº¯Êý·µ»Ø + &false; ¶ø²»ÔÙÊÇ <literal>-1</literal> + </entry> + </row> + </tbody> + </tgroup> + </informaltable> + </para> + </refsect1> + + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title><function>mktime</function> Àý×Ó</title> + <para> + <function>mktime</function> + ÔÚ×öÈÕÆÚ¼ÆËãºÍÑéÖ¤·½ÃæºÜÓÐÓã¬Ëü»á×Ô¶¯¼ÆË㳬³ö·¶Î§µÄÊäÈëµÄÕýÈ·Öµ¡£ÀýÈçÏÂÃæÀý×ÓÖÐÿһÐж¼»á²úÉú×Ö·û´® + "Jan-01-1998"¡£ </para> - <note> - <para> - <parameter>is_dst</parameter> ÊÇ 3.0.10 °æÐ¼ӵġ£ - </para> - </note> - <para> - <function>mktime</function> ¿ÉÒÔÓÃÀ´×öÈÕÆÚ¼ÆËãºÍÑéÖ¤£¬¶ÔÓÚ³¬³ö·¶Î§µÄÊäÈëËü¿ÉÒÔ×Ô¶¯¼ÆËã³öÕýÈ·µÄÖµÀ´¡£ÀýÈ磬ÏÂÃæµÄÿһÐж¼»áÊä³ö×Ö·û´®¡°Jan-01-1998¡±¡£ - <example> - <title><function>mktime</function> Àý×Ó</title> - <programlisting role="php"> + <programlisting role="php"> <![CDATA[ <?php -echo date ("M-d-Y", mktime (0,0,0,12,32,1997)); -echo date ("M-d-Y", mktime (0,0,0,13,1,1997)); -echo date ("M-d-Y", mktime (0,0,0,1,1,1998)); -echo date ("M-d-Y", mktime (0,0,0,1,1,98)); +echo date("M-d-Y", mktime(0, 0, 0, 12, 32, 1997)); +echo date("M-d-Y", mktime(0, 0, 0, 13, 1, 1997)); +echo date("M-d-Y", mktime(0, 0, 0, 1, 1, 1998)); +echo date("M-d-Y", mktime(0, 0, 0, 1, 1, 98)); ?> ]]> - </programlisting> - </example> - <parameter>Year</parameter> ¿ÉÒÔÊÇÁ½Î»»òËÄλÊý×Ö£¬È¡Öµ´Ó - 0-69 ±íʾ 2000-2069 ÒÔ¼° 70-99 ±íʾ 1970-1999£¨ÔÚÈç½ñºÜ³£¼ûµÄ - time_t ÊÇ 32 λÓзûºÅÕûÊýµÄϵͳÖУ¬<parameter>year</parameter> - µÄÓÐЧ·¶Î§ÊÇ 1901 µ½ 2038£©¡£ + </programlisting> + </example> + </para> + <para> + <example> + <title>ϸöÔµÄ×îºóÒ»Ìì</title> + <para> + Èκθø¶¨Ô·ݵÄ×îºóÒ»Ìì¶¼¿ÉÒÔ±»±íʾΪϸöÔÂµÄµÚ "0" + Ì죬¶ø²»ÊÇ -1 Ìì¡£ÏÂÃæÁ½¸öÀý×Ó¶¼»á²úÉú×Ö·û´® + "The last day in Feb 2000 is: 29"¡£ </para> - <para> - <note> - <title>Windows</title> - <simpara> - ĿǰËùÓÐµÄ Windows ϵͳ¶¼²»Ö§³Ö¸ºµÄʱ¼ä´Á¡£Òò´ËºÏ·¨µÄÄê·Ý·¶Î§Ö»°üÀ¨´Ó - 1970 µ½ 2038¡£ - </simpara> - </note> - </para> - <para> - ¸ø¶¨Ô·ݵÄ×îºóÒ»Ìì¿ÉÒÔ±í´ïΪϸöÔÂµÄµÚ "0" Ì죬¶ø²»ÊÇ -1 - Ìì¡£ÏÂÃæÁ½¸öÀý×Ó¶¼½«²úÉú×Ö·û´®¡°The last day in Feb 2000 is: 29¡±¡£ - <example> - <title>ÿ¸öÔµÄ×îºóÒ»Ìì</title> - <programlisting role="php"> + <programlisting role="php"> <![CDATA[ <?php -$lastday = mktime (0,0,0,3,0,2000); -echo strftime ("Last day in Feb 2000 is: %d", $lastday); - -$lastday = mktime (0,0,0,4,-31,2000); -echo strftime ("Last day in Feb 2000 is: %d", $lastday); +$lastday = mktime(0, 0, 0, 3, 0, 2000); +echo strftime("Last day in Feb 2000 is: %d", $lastday); +$lastday = mktime(0, 0, 0, 4, -31, 2000); +echo strftime("Last day in Feb 2000 is: %d", $lastday); ?> ]]> - </programlisting> - </example> - </para> - <simpara> - Ä꣬Ô£¬ÈÕ¶¼µÈÓÚÁãµÄÈÕÆÚ±»ÈÏΪÊÇ·Ç·¨µÄ£¨·ñÔò»á±»µ±×÷ - 30.11.1999£¬ÕâÊǺֵܹÄÐÐΪ£©¡£ - </simpara> - <para> - ²Î¼û <function>date</function> ºÍ <function>time</function>¡£ - </para> - </refsect1> - </refentry> + </programlisting> + </example> + </para> + </refsect1> + + <refsect1 role="notes"> + &reftitle.notes; + <caution> + <para> + ÔÚ PHP 5.1.0 ֮ǰ£¬ÔÚÈκÎÒÑÖª Windows + °æ±¾ÒÔ¼°Ò»Ð©ÆäËüϵͳϲ»Ö§³Ö¸ºµÄʱ¼ä´Á¡£Òò´ËÄê·ÝµÄÓÐЧ·¶Î§ÏÞÖÆÎª + 1970 µ½ 2038¡£ + </para> + </caution> + </refsect1> + + <refsect1 role="seealso"> + &reftitle.seealso; + <para> + <simplelist> + <member><function>gmmktime</function></member> + <member><function>date</function></member> + <member><function>time</function></member> + </simplelist> + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/diff.php/phpdoc-zh/reference/datetime/functions/strftime.xml?r1=1.6&r2=1.7&ty=u Index: phpdoc-zh/reference/datetime/functions/strftime.xml diff -u phpdoc-zh/reference/datetime/functions/strftime.xml:1.6 phpdoc-zh/reference/datetime/functions/strftime.xml:1.7 --- phpdoc-zh/reference/datetime/functions/strftime.xml:1.6 Sun Aug 17 02:41:54 2003 +++ phpdoc-zh/reference/datetime/functions/strftime.xml Tue Aug 30 16:28:19 2005 @@ -1,257 +1,253 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.6 $ --> +<!-- $Revision: 1.7 $ --> <!-- $Author: dallas $ --> -<!-- EN-Revision: 1.9 Maintainer: dallas Status: ready --> - <refentry id="function.strftime"> - <refnamediv> - <refname>strftime</refname> - <refpurpose> - ¸ù¾ÝÇøÓòÉèÖøñʽ»¯±¾µØÊ±¼ä£¯ÈÕÆÚ - </refpurpose> - </refnamediv> - <refsect1> - <title>˵Ã÷</title> - <methodsynopsis> - <type>string</type><methodname>strftime</methodname> - <methodparam><type>string</type><parameter>format</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter> - timestamp - </parameter></methodparam> - </methodsynopsis> +<!-- EN-Revision: 1.16 Maintainer: dallas Status: ready --> +<refentry id="function.strftime"> + <refnamediv> + <refname>strftime</refname> + <refpurpose>¸ù¾ÝÇøÓòÉèÖøñʽ»¯±¾µØÊ±¼ä£¯ÈÕÆÚ</refpurpose> + </refnamediv> + <refsect1> + <title>˵Ã÷</title> + <methodsynopsis> + <type>string</type><methodname>strftime</methodname> + <methodparam><type>string</type><parameter>format</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>timestamp</parameter></methodparam> + </methodsynopsis> + <para> + ·µ»ØÓøø¶¨µÄ¸ñʽ×Ö´®¶Ô¸ø³öµÄ <parameter>timestamp</parameter> + ½øÐиñʽÊä³öºóµÄ×Ö·û´®¡£Èç¹ûûÓиø³öʱ¼ä´ÁÔòÓõ±Ç°µÄ±¾µØÊ±¼ä¡£Ô·ݺÍÐÇÆÚ¼¸ÒÔ¼°ÆäËüºÍÓïÑÔÓйصÄ×Ö·û´®Ð´·¨ºÍÓà + <function>setlocale</function> É趨µÄµ±Ç°µÄÇøÓòÓйء£ + </para> + <para> + ¸ñʽ×Ö´®ÄÜʶ±ðÏÂÁÐת»»±ê¼Ç£º + <itemizedlist> + <listitem> + <simpara> + %a - µ±Ç°ÇøÓòÐÇÆÚ¼¸µÄ¼òд + </simpara> + </listitem> + <listitem> + <simpara> + %A - µ±Ç°ÇøÓòÐÇÆÚ¼¸µÄÈ«³Æ + </simpara> + </listitem> + <listitem> + <simpara> + %b - µ±Ç°ÇøÓòÔ·ݵļòд + </simpara> + </listitem> + <listitem> + <simpara> + %B - µ±Ç°ÇøÓòÔ·ݵÄÈ«³Æ + </simpara> + </listitem> + <listitem> + <simpara> + %c - µ±Ç°ÇøÓòÊ×Ñ¡µÄÈÕÆÚʱ¼ä±í´ï + </simpara> + </listitem> + <listitem> + <simpara> + %C - ÊÀ¼ÍÖµ£¨Äê·Ý³ýÒÔ 100 ºóÈ¡Õû£¬·¶Î§´Ó 00 µ½ 99£© + </simpara> + </listitem> + <listitem> + <simpara> + %d - Ô·ÝÖеĵڼ¸Ì죬ʮ½øÖÆÊý×Ö£¨·¶Î§´Ó 01 µ½ 31£© + </simpara> + </listitem> + <listitem> + <simpara> + %D - ºÍ %m/%d/%y Ò»Ñù + </simpara> + </listitem> + <listitem> + <simpara> + %e - Ô·ÝÖеĵڼ¸Ì죬ʮ½øÖÆÊý×Ö£¬Ò»Î»µÄÊý×Öǰ»á¼ÓÉÏÒ»¸ö¿Õ¸ñ£¨·¶Î§´Ó ' 1' µ½ '31'£© + </simpara> + </listitem> + <listitem> + <simpara> + %g - ºÍ %G Ò»Ñù£¬µ«ÊÇûÓÐÊÀ¼Í + </simpara> + </listitem> + <listitem> + <simpara> + %G - 4 λÊýµÄÄê·Ý£¬·ûºÏ ISO ÐÇÆÚÊý£¨²Î¼û + %V£©¡£ºÍ %V µÄ¸ñʽºÍÖµÒ»Ñù£¬Ö»³ýÁËÈç¹û ISO + ÐÇÆÚÊýÊôÓÚǰһÄê»òÕߺóÒ»Ä꣬ÔòʹÓÃÄÇÒ»Äê¡£ + </simpara> + </listitem> + <listitem> + <simpara> + %h - ºÍ %b Ò»Ñù + </simpara> + </listitem> + <listitem> + <simpara> + %H - 24 Ð¡Ê±ÖÆµÄÊ®½øÖÆÐ¡Ê±Êý£¨·¶Î§´Ó 00 µ½ 23£© + </simpara> + </listitem> + <listitem> + <simpara> + %I - 12 Ð¡Ê±ÖÆµÄÊ®½øÖÆÐ¡Ê±Êý£¨·¶Î§´Ó 00 µ½ 12£© + </simpara> + </listitem> + <listitem> + <simpara> + %j - Äê·ÝÖеĵڼ¸Ì죬ʮ½øÖÆÊý£¨·¶Î§´Ó 001 µ½ 366£© + </simpara> + </listitem> + <listitem> + <simpara> + %m - Ê®½øÖÆÔ·ݣ¨·¶Î§´Ó 01 µ½ 12£© + </simpara> + </listitem> + <listitem> + <simpara> + %M - Ê®½øÖÆ·ÖÖÓÊý + </simpara> + </listitem> + <listitem> + <simpara> + %n - »»Ðзû + </simpara> + </listitem> + <listitem> + <simpara> + %p - ¸ù¾Ý¸ø¶¨µÄʱ¼äֵΪ `am' »ò `pm'£¬»òÕßµ±Ç°ÇøÓòÉèÖÃÖеÄÏàÓ¦×Ö·û´® + </simpara> + </listitem> + <listitem> + <simpara> + %r - Óà a.m. ºÍ p.m. ·ûºÅµÄʱ¼ä + </simpara> + </listitem> + <listitem> + <simpara> + %R - 24 Сʱ·ûºÅµÄʱ¼ä + </simpara> + </listitem> + <listitem> + <simpara> + %S - Ê®½øÖÆÃëÊý + </simpara> + </listitem> + <listitem> + <simpara> + %t - ÖÆ±í·û + </simpara> + </listitem> + <listitem> + <simpara> + %T - µ±Ç°Ê±¼ä£¬ºÍ %H:%M:%S Ò»Ñù + </simpara> + </listitem> + <listitem> + <simpara> + %u - ÐÇÆÚ¼¸µÄÊ®½øÖÆÊý±í´ï [1,7]£¬1 ±íʾÐÇÆÚÒ» + </simpara> + <warning> + <simpara> + ¾¡¹Ü ISO 9889:1999£¨µ±Ç°µÄ C ±ê×¼£©Ã÷È·Ö¸³öÒ»ÖÜ´ÓÐÇÆÚÒ»¿ªÊ¼£¬µ«ÊÇ + Sun Solaris µÄÒ»ÖÜËÆºõ´ÓÐÇÆÚÌ쿪ʼ²¢×÷Ϊ 1¡£ + </simpara> + </warning> + </listitem> + <listitem> + <simpara> + %U - ±¾ÄêµÄµÚ¼¸ÖÜ£¬´ÓµÚÒ»ÖܵĵÚÒ»¸öÐÇÆÚÌì×÷ΪµÚÒ»Ì쿪ʼ + </simpara> + </listitem> + <listitem> + <simpara> + %V - ±¾ÄêµÚ¼¸ÖÜµÄ ISO 8601:1988 ¸ñʽ£¬·¶Î§´Ó 01 µ½ 53£¬µÚ + 1 ÖÜÊDZ¾ÄêµÚÒ»¸öÖÁÉÙ»¹ÓÐ 4 ÌìµÄÐÇÆÚ£¬ÐÇÆÚÒ»×÷ΪÿÖܵĵÚÒ»Ìì¡££¨Óà + %G »òÕß %g ×÷Ϊָ¶¨Ê±¼ä´ÁÏàÓ¦ÖÜÊýµÄÄê·Ý×é³É¡££© + </simpara> + </listitem> + <listitem> + <simpara> + %W - ±¾ÄêµÄµÚ¼¸ÖÜÊý£¬´ÓµÚÒ»ÖܵĵÚÒ»¸öÐÇÆÚÒ»×÷ΪµÚÒ»Ì쿪ʼ + </simpara> + </listitem> + <listitem> + <simpara> + %w - ÐÇÆÚÖеĵڼ¸Ì죬ÐÇÆÚÌìΪ 0 + </simpara> + </listitem> + <listitem> + <simpara> + %x - µ±Ç°ÇøÓòÊ×Ñ¡µÄʱ¼ä±íʾ·¨£¬²»°üÀ¨Ê±¼ä + </simpara> + </listitem> + <listitem> + <simpara> + %X - µ±Ç°ÇøÓòÊ×Ñ¡µÄʱ¼ä±íʾ·¨£¬²»°üÀ¨ÈÕÆÚ + </simpara> + </listitem> + <listitem> + <simpara> + %y - ûÓÐÊÀ¼ÍÊýµÄÊ®½øÖÆÄê·Ý£¨·¶Î§´Ó 00 µ½ 99£© + </simpara> + </listitem> + <listitem> + <simpara> + %Y - °üÀ¨ÊÀ¼ÍÊýµÄÊ®½øÖÆÄê·Ý + </simpara> + </listitem> + <listitem> + <simpara> + %Z »ò %z - Ê±ÇøÃû»òËõд + </simpara> + </listitem> + <listitem> + <simpara> + %% - ÎÄ×ÖÉ쵀 `%' ×Ö·û + </simpara> + </listitem> + </itemizedlist> + <note> <para> - ·µ»ØÓøø¶¨µÄ¸ñʽ×Ö´®¶Ô¸ø³öµÄ <parameter>timestamp</parameter> - ½øÐиñʽÊä³öºóµÄ×Ö·û´®¡£Èç¹ûûÓиø³öʱ¼ä´ÁÔòÓõ±Ç°µÄ±¾µØÊ±¼ä¡£Ô·ݺÍÐÇÆÚ¼¸ÒÔ¼°ÆäËüºÍÓïÑÔÓйصÄ×Ö·û´®Ð´·¨ºÍÓà - <function>setlocale</function> É趨µÄµ±Ç°µÄÇøÓòÓйء£ + ¿ÉÄܲ»ÊÇËùÓеÄת»»±ê¼Ç¶¼±» C ¿âÎļþÖ§³Ö£¬ÕâÖÖÇé¿öÏ PHP + µÄ <function>strftime</function> + Ò²²»Ö§³Ö¡£´ËÍ⣬²»ÊÇËùÓÐµÄÆ½Ì¨¶¼Ö§³Ö¸ºµÄʱ¼ä´Á£¬Òò´ËÈÕÆÚµÄ·¶Î§¿ÉÄÜÏÞ¶¨ÔÚ²»ÔçÓÚ + Unix ¼ÍÔª¡£ÕâÒâζ×ÅÀýÈç + %e, %T£¬%R ºÍ %D£¨¿ÉÄܸü¶à£©ÒÔ¼°ÔçÓÚ + <literal>Jan 1, 1970</literal> µÄʱ¼äÔÚ Windows£¬Ò»Ð© Linux + ·¢Ðа汾£¬ÒÔ¼°ÆäËü¼¸¸ö²Ù×÷ϵͳÖÐÎÞЧ¡£¶ÔÓÚ Windows + ϵͳ£¬ËùÖ§³ÖµÄת»»±ê¼Ç¿ÉÔÚ + <ulink url="&url.strftime.win32;"><acronym>MSDN</acronym> ÍøÕ¾</ulink>ÕÒµ½¡£ </para> - <para> - ¸ñʽ×Ö´®ÄÜʶ±ðÏÂÁÐת»»±ê¼Ç£º - <itemizedlist> - <listitem> - <simpara> - %a - µ±Ç°ÇøÓòÐÇÆÚ¼¸µÄ¼òд - </simpara> - </listitem> - <listitem> - <simpara> - %A - µ±Ç°ÇøÓòÐÇÆÚ¼¸µÄÈ«³Æ - </simpara> - </listitem> - <listitem> - <simpara> - %b - µ±Ç°ÇøÓòÔ·ݵļòд - </simpara> - </listitem> - <listitem> - <simpara> - %B - µ±Ç°ÇøÓòÔ·ݵÄÈ«³Æ - </simpara> - </listitem> - <listitem> - <simpara> - %c - µ±Ç°ÇøÓòÊ×Ñ¡µÄÈÕÆÚʱ¼ä±í´ï - </simpara> - </listitem> - <listitem> - <simpara> - %C - ÊÀ¼ÍÖµ£¨Äê·Ý³ýÒÔ 100 ºóÈ¡Õû£¬·¶Î§´Ó 00 µ½ 99£© - </simpara> - </listitem> - <listitem> - <simpara> - %d - Ô·ÝÖеĵڼ¸Ì죬ʮ½øÖÆÊý×Ö£¨·¶Î§´Ó 01 µ½ 31£© - </simpara> - </listitem> - <listitem> - <simpara> - %D - ºÍ %m/%d/%y Ò»Ñù - </simpara> - </listitem> - <listitem> - <simpara> - %e - Ô·ÝÖеĵڼ¸Ì죬ʮ½øÖÆÊý×Ö£¬Ò»Î»µÄÊý×Öǰ»á¼ÓÉÏÒ»¸ö¿Õ¸ñ£¨·¶Î§´Ó ' 1' µ½ '31'£© - </simpara> - </listitem> - <listitem> - <simpara> - %g - ºÍ %G Ò»Ñù£¬µ«ÊÇûÓÐÊÀ¼Í - </simpara> - </listitem> - <listitem> - <simpara> - %G - 4 λÊýµÄÄê·Ý£¬·ûºÏ ISO ÐÇÆÚÊý£¨²Î¼û - %V£©¡£ºÍ %V µÄ¸ñʽºÍÖµÒ»Ñù£¬Ö»³ýÁËÈç¹û ISO - ÐÇÆÚÊýÊôÓÚǰһÄê»òÕߺóÒ»Ä꣬ÔòʹÓÃÄÇÒ»Äê¡£ - </simpara> - </listitem> - <listitem> - <simpara> - %h - ºÍ %b Ò»Ñù - </simpara> - </listitem> - <listitem> - <simpara> - %H - 24 Ð¡Ê±ÖÆµÄÊ®½øÖÆÐ¡Ê±Êý£¨·¶Î§´Ó 00 µ½ 23£© - </simpara> - </listitem> - <listitem> - <simpara> - %I - 12 Ð¡Ê±ÖÆµÄÊ®½øÖÆÐ¡Ê±Êý£¨·¶Î§´Ó 00 µ½ 12£© - </simpara> - </listitem> - <listitem> - <simpara> - %j - Äê·ÝÖеĵڼ¸Ì죬ʮ½øÖÆÊý£¨·¶Î§´Ó 001 µ½ 366£© - </simpara> - </listitem> - <listitem> - <simpara> - %m - Ê®½øÖÆÔ·ݣ¨·¶Î§´Ó 01 µ½ 12£© - </simpara> - </listitem> - <listitem> - <simpara> - %M - Ê®½øÖÆ·ÖÖÓÊý - </simpara> - </listitem> - <listitem> - <simpara> - %n - »»Ðзû - </simpara> - </listitem> - <listitem> - <simpara> - %p - ¸ù¾Ý¸ø¶¨µÄʱ¼äֵΪ `am' »ò `pm'£¬»òÕßµ±Ç°ÇøÓòÉèÖÃÖеÄÏàÓ¦×Ö·û´® - </simpara> - </listitem> - <listitem> - <simpara> - %r - Óà a.m. ºÍ p.m. ·ûºÅµÄʱ¼ä - </simpara> - </listitem> - <listitem> - <simpara> - %R - 24 Сʱ·ûºÅµÄʱ¼ä - </simpara> - </listitem> - <listitem> - <simpara> - %S - Ê®½øÖÆÃëÊý - </simpara> - </listitem> - <listitem> - <simpara> - %t - ÖÆ±í·û - </simpara> - </listitem> - <listitem> - <simpara> - %T - µ±Ç°Ê±¼ä£¬ºÍ %H:%M:%S Ò»Ñù - </simpara> - </listitem> - <listitem> - <simpara> - %u - ÐÇÆÚ¼¸µÄÊ®½øÖÆÊý±í´ï [1,7]£¬1 ±íʾÐÇÆÚÒ» - </simpara> - <warning> - <simpara> - ¾¡¹Ü ISO 9889:1999£¨µ±Ç°µÄ C ±ê×¼£©Ã÷È·Ö¸³öÒ»ÖÜ´ÓÐÇÆÚÒ»¿ªÊ¼£¬µ«ÊÇ - Sun Solaris µÄÒ»ÖÜËÆºõ´ÓÐÇÆÚÌ쿪ʼ²¢×÷Ϊ 1¡£ - </simpara> - </warning> - </listitem> - <listitem> - <simpara> - %U - ±¾ÄêµÄµÚ¼¸ÖÜ£¬´ÓµÚÒ»ÖܵĵÚÒ»¸öÐÇÆÚÌì×÷ΪµÚÒ»Ì쿪ʼ - </simpara> - </listitem> - <listitem> - <simpara> - %V - ±¾ÄêµÚ¼¸ÖÜµÄ ISO 8601:1988 ¸ñʽ£¬·¶Î§´Ó 01 µ½ 53£¬µÚ - 1 ÖÜÊDZ¾ÄêµÚÒ»¸öÖÁÉÙ»¹ÓÐ 4 ÌìµÄÐÇÆÚ£¬ÐÇÆÚÒ»×÷ΪÿÖܵĵÚÒ»Ìì¡££¨Óà - %G »òÕß %g ×÷Ϊָ¶¨Ê±¼ä´ÁÏàÓ¦ÖÜÊýµÄÄê·Ý×é³É¡££© - </simpara> - </listitem> - <listitem> - <simpara> - %W - ±¾ÄêµÄµÚ¼¸ÖÜÊý£¬´ÓµÚÒ»ÖܵĵÚÒ»¸öÐÇÆÚÒ»×÷ΪµÚÒ»Ì쿪ʼ - </simpara> - </listitem> - <listitem> - <simpara> - %w - ÐÇÆÚÖеĵڼ¸Ì죬ÐÇÆÚÌìΪ 0 - </simpara> - </listitem> - <listitem> - <simpara> - %x - µ±Ç°ÇøÓòÊ×Ñ¡µÄʱ¼ä±íʾ·¨£¬²»°üÀ¨Ê±¼ä - </simpara> - </listitem> - <listitem> - <simpara> - %X - µ±Ç°ÇøÓòÊ×Ñ¡µÄʱ¼ä±íʾ·¨£¬²»°üÀ¨ÈÕÆÚ - </simpara> - </listitem> - <listitem> - <simpara> - %y - ûÓÐÊÀ¼ÍÊýµÄÊ®½øÖÆÄê·Ý£¨·¶Î§´Ó 00 µ½ 99£© - </simpara> - </listitem> - <listitem> - <simpara> - %Y - °üÀ¨ÊÀ¼ÍÊýµÄÊ®½øÖÆÄê·Ý - </simpara> - </listitem> - <listitem> - <simpara> - %Z - Ê±ÇøÃû»òËõд - </simpara> - </listitem> - <listitem> - <simpara> - %% - ÎÄ×ÖÉ쵀 `%' ×Ö·û - </simpara> - </listitem> - </itemizedlist> - <note> - <para> - ¿ÉÄܲ»ÊÇËùÓеÄת»»±ê¼Ç¶¼±» C ¿âÎļþÖ§³Ö£¬ÕâÖÖÇé¿öÏ PHP - µÄ <function>strftime</function> - Ò²²»Ö§³Ö¡£´ËÍ⣬²»ÊÇËùÓÐµÄÆ½Ì¨¶¼Ö§³Ö¸ºµÄʱ¼ä´Á£¬Òò´ËÈÕÆÚµÄ·¶Î§¿ÉÄÜÏÞ¶¨ÔÚ²»ÔçÓÚ - Unix ¼ÍÔª¡£ÕâÒâζ×ÅÀýÈç - %e, %T£¬%R ºÍ %D£¨¿ÉÄܸü¶à£©ÒÔ¼°ÔçÓÚ - <literal>Jan 1, 1970</literal> µÄʱ¼äÔÚ Windows£¬Ò»Ð© Linux - ·¢Ðа汾£¬ÒÔ¼°ÆäËü¼¸¸ö²Ù×÷ϵͳÖÐÎÞЧ¡£¶ÔÓÚ Windows - ϵͳ£¬ËùÖ§³ÖµÄת»»±ê¼Ç¿ÉÔÚ - <ulink url="&url.strftime.win32;"><acronym>MSDN</acronym> ÍøÕ¾</ulink>ÕÒµ½¡£ - </para> - </note> - <example> - <title><function>strftime</function> ÇøÓòµÄÀý×Ó</title> - <programlisting role="php"> + </note> + <example> + <title><function>strftime</function> ÇøÓòµÄÀý×Ó</title> + <programlisting role="php"> <![CDATA[ <?php -setlocale (LC_TIME, "C"); -print (strftime ("%A in Finnish is ")); -setlocale (LC_TIME, "fi_FI"); -print (strftime ("%A, in French ")); -setlocale (LC_TIME, "fr_FR"); -print (strftime ("%A and in German ")); -setlocale (LC_TIME, "de_DE"); -print (strftime ("%A.\n")); +setlocale(LC_TIME, "C"); +echo strftime("%A"); +setlocale(LC_TIME, "fi_FI"); +echo strftime(" in Finnish is %A,"); +setlocale(LC_TIME, "fr_FR"); +echo strftime(" in French %A and"); +setlocale(LC_TIME, "de_DE"); +echo strftime(" in German %A.\n"); ?> ]]> - </programlisting> - </example> - ±¾ÀýÔÚÄãµÄϵͳÖа²×°Óи÷×ÔµÄÇøÓòÉèÖúó²ÅÄܹ¤×÷¡£ - <note> - <simpara> - %G ºÍ %V£¬Èç¹ûÊý×Ö±àºÅϵͳδÄܳä·ÖÀí½â£¬»ùÓÚ ISO 8601:1988 - µÄÐÇÆÚÊý¿ÉÄܵóöδԤÆÚµÄ½á¹û¡£¼ûÉÏÃæµÄ %V ºÍÒÔϵÄÀý×Ó¡£ - </simpara> - </note> - <example> - <title>ISO 8601:1988 week number example</title> - <programlisting role="php"> + </programlisting> + </example> + ±¾ÀýÔÚÄãµÄϵͳÖа²×°Óи÷×ÔµÄÇøÓòÉèÖúó²ÅÄܹ¤×÷¡£ + <note> + <simpara> + %G ºÍ %V£¬Èç¹ûÊý×Ö±àºÅϵͳδÄܳä·ÖÀí½â£¬»ùÓÚ ISO 8601:1988 + µÄÐÇÆÚÊý¿ÉÄܵóöδԤÆÚµÄ½á¹û¡£¼ûÉÏÃæµÄ %V ºÍÒÔϵÄÀý×Ó¡£ + </simpara> + </note> + <example> + <title>ISO 8601:1988 week number example</title> + <programlisting role="php"> <![CDATA[ <?php /* December 2002 / January 2003 @@ -264,16 +260,16 @@ 3 13 14 15 16 17 18 19 */ // Outputs: 12/28/2002 - %V,%G,%Y = 52,2002,2002 -print "12/28/2002 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("12/28/2002")) . "\n"; +echo "12/28/2002 - %V,%G,%Y = " . strftime("%V,%G,%Y", strtotime("12/28/2002")) . "\n"; // Outputs: 12/30/2002 - %V,%G,%Y = 1,2003,2002 -print "12/30/2002 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("12/30/2002")) . "\n"; +echo "12/30/2002 - %V,%G,%Y = " . strftime("%V,%G,%Y", strtotime("12/30/2002")) . "\n"; // Outputs: 1/3/2003 - %V,%G,%Y = 1,2003,2003 -print "1/3/2003 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("1/3/2003")) . "\n"; +echo "1/3/2003 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("1/3/2003")) . "\n"; // Outputs: 1/10/2003 - %V,%G,%Y = 2,2003,2003 -print "1/10/2003 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("1/10/2003")) . "\n"; +echo "1/10/2003 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("1/10/2003")) . "\n"; @@ -287,29 +283,29 @@ 2 10 11 12 13 14 15 16 */ // Outputs: 12/23/2004 - %V,%G,%Y = 52,2004,2004 -print "12/23/2004 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("12/23/2004")) . "\n"; +echo "12/23/2004 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("12/23/2004")) . "\n"; // Outputs: 12/31/2004 - %V,%G,%Y = 53,2004,2004 -print "12/31/2004 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("12/31/2004")) . "\n"; +echo "12/31/2004 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("12/31/2004")) . "\n"; // Outputs: 1/2/2005 - %V,%G,%Y = 53,2004,2005 -print "1/2/2005 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("1/2/2005")) . "\n"; +echo "1/2/2005 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("1/2/2005")) . "\n"; // Outputs: 1/3/2005 - %V,%G,%Y = 1,2005,2005 -print "1/3/2005 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("1/3/2005")) . "\n"; +echo "1/3/2005 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("1/3/2005")) . "\n"; ?> ]]> - </programlisting> - </example> - </para> - <para> - ²Î¼û <function>setlocale</function> ºÍ <function>mktime</function> - ÒÔ¼° <ulink url="&spec.strftime;">Open Group specification of - <function>strftime</function></ulink>¡£ - </para> - </refsect1> - </refentry> + </programlisting> + </example> + </para> + <para> + ²Î¼û <function>setlocale</function>£¬<function>mktime</function>£¬<function>strptime</function> + ÒÔ¼° <ulink url="&spec.strftime;">Open Group specification of + <function>strftime</function></ulink>¡£ + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/diff.php/phpdoc-zh/reference/datetime/functions/strtotime.xml?r1=1.4&r2=1.5&ty=u Index: phpdoc-zh/reference/datetime/functions/strtotime.xml diff -u phpdoc-zh/reference/datetime/functions/strtotime.xml:1.4 phpdoc-zh/reference/datetime/functions/strtotime.xml:1.5 --- phpdoc-zh/reference/datetime/functions/strtotime.xml:1.4 Sun Apr 20 02:22:53 2003 +++ phpdoc-zh/reference/datetime/functions/strtotime.xml Tue Aug 30 16:28:19 2005 @@ -1,76 +1,162 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <!-- $Author: dallas $ --> -<!-- EN-Revision: 1.3 Maintainer: dallas Status: ready --> - <refentry id="function.strtotime"> - <refnamediv> - <refname>strtotime</refname> - <refpurpose> - ½«ÈκÎÓ¢ÎÄÎı¾µÄÈÕÆÚʱ¼äÃèÊö½âÎöΪ UNIX ʱ¼ä´Á - </refpurpose> - </refnamediv> - <refsect1> - <title>˵Ã÷</title> - <methodsynopsis> - <type>int</type><methodname>strtotime</methodname> - <methodparam><type>string</type><parameter>time</parameter></methodparam> - <methodparam choice="opt"><type>int</type><parameter>now</parameter></methodparam> - </methodsynopsis> - <simpara> - ±¾º¯ÊýÔ¤ÆÚ½ÓÊÜÒ»¸ö°üº¬Ó¢ÎÄÈÕÆÚ¸ñʽµÄ×Ö·û´®²¢³¢ÊÔ½«Æä½âÎöΪ - UNIX ʱ¼ä´Á¡£Èç¹û time µÄ¸ñʽÊǾø¶Ôʱ¼äÔò now - ²ÎÊý²»Æð×÷Óá£Èç¹û time µÄ¸ñʽÊÇÏà¶Ôʱ¼äÔòÆäËùÏà¶ÔµÄʱ¼äÓÉ - now Ìṩ£¬»òÕßÈç¹ûδÌṩ now ²ÎÊýʱÓõ±Ç°Ê±¼ä¡£Ê§°Üʱ·µ»Ø <literal>-1</literal>¡£ - </simpara> - <simpara> - ÒòΪ <function>strtotime</function> µÄÐÐΪÊÇÒÀÕÕ GNU - ÈÕÆÚÓï·¨µÄ£¬Òò´ËÇë¿´¿´ GNU ÊÖ²áÖÐµÄ - <ulink url="&url.gnu.man.date-input;">Date Input - Formats</ulink>¡£ÕâÀï¼ÇÊöÁË <parameter>time</parameter> ²ÎÊýµÄºÏ·¨Óï·¨¡£ - </simpara> - <para> - <example> - <title><function>strtotime</function> Àý×Ó</title> - <programlisting role="php"> +<!-- EN-Revision: 1.16 Maintainer: dallas Status: ready --> +<refentry id="function.strtotime"> + <refnamediv> + <refname>strtotime</refname> + <refpurpose>½«ÈκÎÓ¢ÎÄÎı¾µÄÈÕÆÚʱ¼äÃèÊö½âÎöΪ Unix ʱ¼ä´Á</refpurpose> + </refnamediv> + <refsect1 role="description"> + &reftitle.description; + <methodsynopsis> + <type>int</type><methodname>strtotime</methodname> + <methodparam><type>string</type><parameter>time</parameter></methodparam> + <methodparam choice="opt"><type>int</type><parameter>now</parameter></methodparam> + </methodsynopsis> + <simpara> + ±¾º¯ÊýÔ¤ÆÚ½ÓÊÜÒ»¸ö°üº¬ÃÀ¹úÓ¢ÓïÈÕÆÚ¸ñʽµÄ×Ö·û´®²¢³¢ÊÔ½«Æä½âÎöΪ + Unix ʱ¼ä´Á£¨×Ô January 1 1970 00:00:00 GMT ÆðµÄÃëÊý£©£¬ÆäÖµÏà¶ÔÓÚ + <parameter>now</parameter> ²ÎÊý¸ø³öµÄʱ¼ä£¬Èç¹ûûÓÐÌṩ´Ë²ÎÊýÔòÓÃϵͳµ±Ç°Ê±¼ä¡£ + <para> + ±¾º¯Êý½«Ê¹Óà <envar>TZ</envar> »·¾³±äÁ¿£¨Èç¹ûÓеϰ£©À´¼ÆËãʱ¼ä´Á¡£×Ô + PHP 5.1.0 ÆðÓиüÈÝÒ׵ķ½·¨À´¶¨ÒåÊ±ÇøÓÃÓÚËùÓеÄÈÕÆÚ£¯Ê±¼äº¯Êý¡£´Ë¹ý³ÌÔÚ + <function>date_default_timezone_get</function> º¯ÊýÒ³ÃæÖÐÓÐ˵Ã÷¡£ + </para> + <note> + <para> + Èç¹û¸ø¶¨µÄÄê·ÝÊÇÁ½Î»Êý×ֵĸñʽ£¬ÔòÆäÖµ 0-69 ±íʾ 2000-2069£¬70-100 + ±íʾ 1970-2000¡£ + </para> + </note> + </refsect1> + + <refsect1 role="parameters"> + &reftitle.parameters; + <para> + <variablelist> + <varlistentry> + <term><parameter>time</parameter></term> + <listitem> + <para> + ±»½âÎöµÄ×Ö·û´®£¬¸ñʽ¸ù¾Ý GNU <ulink + url="&url.gnu.man.date-input;">Date Input Formats</ulink> Óï·¨ + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>now</parameter></term> + <listitem> + <para> + ÓÃÀ´¼ÆËã·µ»ØÖµµÄʱ¼ä´Á + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </refsect1> + + <refsect1 role="returnvalues"> + &reftitle.returnvalues; + <para> + ³É¹¦Ôò·µ»ØÊ±¼ä´Á£¬·ñÔò·µ»Ø &false;¡£ÔÚ PHP 5.1.0 + ֮ǰ±¾º¯ÊýÔÚʧ°Üʱ·µ»Ø <literal>-1</literal>¡£ + </para> + </refsect1> + + <refsect1 role="changelog"> + &reftitle.changelog; + <para> + <informaltable> + <tgroup cols="2"> + <thead> + <row> + <entry>&Version;</entry> + <entry>&Description;</entry> + </row> + </thead> + <tbody> + <row> + <entry>5.1.0</entry> + <entry> + ʧ°Üʱ·µ»Ø &false;£¬²»ÔÙÊÇ <literal>-1</literal>¡£ + </entry> + </row> + </tbody> + </tgroup> + </informaltable> + </para> + </refsect1> + + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title><function>strtotime</function> Àý×Ó</title> + <programlisting role="php"> <![CDATA[ <?php -echo strtotime ("now"), "\n"; -echo strtotime ("10 September 2000"), "\n"; -echo strtotime ("+1 day"), "\n"; -echo strtotime ("+1 week"), "\n"; -echo strtotime ("+1 week 2 days 4 hours 2 seconds"), "\n"; -echo strtotime ("next Thursday"), "\n"; -echo strtotime ("last Monday"), "\n"; +echo strtotime("now"), "\n"; +echo strtotime("10 September 2000"), "\n"; +echo strtotime("+1 day"), "\n"; +echo strtotime("+1 week"), "\n"; +echo strtotime("+1 week 2 days 4 hours 2 seconds"), "\n"; +echo strtotime("next Thursday"), "\n"; +echo strtotime("last Monday"), "\n"; ?> ]]> - </programlisting> - </example> - </para> - <para> - <example> - <title>¼ì²éʧ°Ü</title> - <programlisting role="php"> + </programlisting> + </example> + </para> + <para> + <example> + <title>ʧ°Ü¼ì²é</title> + <programlisting role="php"> <![CDATA[ <?php $str = 'Not Good'; -if (($timestamp = strtotime($str)) === -1) { + +// previous to PHP 5.1.0 you would compare with -1, instead of false +if (($timestamp = strtotime($str)) === false) { echo "The string ($str) is bogus"; } else { - echo "$str == ". date('l dS of F Y h:i:s A',$timestamp); + echo "$str == " . date('l dS of F Y h:i:s A', $timestamp); } ?> ]]> - </programlisting> - </example> - </para> - <note> - <para> - ÓÐЧµÄʱ¼ä´ÁµäÐÍ·¶Î§ÊÇ´Ó¸ñÁÖÍþÖÎʱ¼ä 1901 Äê 12 Ô 13 ÈÕ ÐÇÆÚÎå 20:45:54 µ½ - 2038Äê 1 Ô 19 ÈÕ ÐÇÆÚ¶þ 03:14:07¡££¨¸ÃÈÕÆÚ¸ù¾Ý 32 λÓзûºÅÕûÊýµÄ×îСֵºÍ×î´óÖµ¶øÀ´¡££© - </para> - </note> - </refsect1> - </refentry> + </programlisting> + </example> + </para> + </refsect1> + + <refsect1 role="notes"> + &reftitle.notes; + <warning> + <para> + ÔÚ PHP 5 Öе½ 5.0.2 ֮ǰ£¬<literal>"now"</literal> + ºÍÆäËüÏà¶Ôʱ¼ä´Ó½ñÌìÎçÒ¹Æð´íÎó¼ÆËãÁË¡£ÕâºÍÕýÈ·´Óµ±Ç°Ê±¼äÆð¼ÆËãµÄÆäËü°æ±¾²»Í¬¡£ + </para> + </warning> + <note> + <para> + ÓÐЧµÄʱ¼ä´Áͨ³£´Ó Fri, 13 Dec 1901 20:45:54 GMT µ½ + Tue, 19 Jan 2038 03:14:07 GMT£¨¶ÔÓ¦ÓÚ 32 + λÓзûºÅÕûÊýµÄ×îСֵºÍ×î´óÖµ£©¡£²»ÊÇËùÓÐµÄÆ½Ì¨¶¼Ö§³Ö¸ºµÄʱ¼ä´Á£¬ÄÇôÈռǷ¶Î§¾Í±»ÏÞÖÆÎª²»ÄÜÔçÓÚ + Unix ¼ÍÔª¡£ÕâÒâζ×ÅÔÚ 1970 Äê 1 Ô 1 ÈÕ֮ǰµÄÈÕÆÚ½«²»ÄÜÓÃÔÚ Windows£¬Ò»Ð© + Linux °æ±¾£¬ÒÔ¼°¼¸¸öÆäËüµÄ²Ù×÷ϵͳÖС£²»¹ý PHP 5.1.0 ¼°¸üеİ汾¿Ë·þÁË´ËÏÞÖÆ¡£ + </para> + </note> + </refsect1> + + <refsect1 role="seealso"> + &reftitle.seealso; + <para> + <simplelist> + <member><function>strptime</function></member> + </simplelist> + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: http://cvs.php.net/diff.php/phpdoc-zh/reference/datetime/functions/time.xml?r1=1.3&r2=1.4&ty=u Index: phpdoc-zh/reference/datetime/functions/time.xml diff -u phpdoc-zh/reference/datetime/functions/time.xml:1.3 phpdoc-zh/reference/datetime/functions/time.xml:1.4 --- phpdoc-zh/reference/datetime/functions/time.xml:1.3 Sun Sep 29 23:07:33 2002 +++ phpdoc-zh/reference/datetime/functions/time.xml Tue Aug 30 16:28:19 2005 @@ -1,26 +1,48 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.3 $ --> +<!-- $Revision: 1.4 $ --> <!-- $Author: dallas $ --> -<!-- EN-Revision: 1.2 Maintainer: dallas Status: ready --> - <refentry id="function.time"> - <refnamediv> - <refname>time</refname> - <refpurpose>·µ»Øµ±Ç°µÄ UNIX ʱ¼ä´Á</refpurpose> - </refnamediv> - <refsect1> - <title>˵Ã÷</title> - <methodsynopsis> - <type>int</type><methodname>time</methodname> - <void/> - </methodsynopsis> - <para> - ·µ»Ø×Ô´Ó Unix мÍÔª£¨¸ñÁÖÍþÖÎʱ¼ä 1970 Äê 1 Ô 1 ÈÕ 00:00:00£©µ½µ±Ç°Ê±¼äµÄÃëÊý¡£ - </para> - <para> - ²Î¼û <function>date</function>¡£ - </para> - </refsect1> - </refentry> +<!-- EN-Revision: 1.6 Maintainer: dallas Status: ready --> +<refentry id="function.time"> + <refnamediv> + <refname>time</refname> + <refpurpose>·µ»Øµ±Ç°µÄ Unix ʱ¼ä´Á</refpurpose> + </refnamediv> + <refsect1> + <title>˵Ã÷</title> + <methodsynopsis> + <type>int</type><methodname>time</methodname> + <void/> + </methodsynopsis> + <para> + ·µ»Ø×Ô´Ó Unix ¼ÍÔª£¨¸ñÁÖÍþÖÎʱ¼ä 1970 Äê 1 Ô 1 ÈÕ 00:00:00£©µ½µ±Ç°Ê±¼äµÄÃëÊý¡£ + </para> + <para> + <example> + <title><function>time</function> Àý×Ó</title> + <programlisting role="php"> +<![CDATA[ +<?php +$nextWeek = time() + (7 * 24 * 60 * 60); + // 7 days; 24 hours; 60 mins; 60secs +echo 'Now: '. date('Y-m-d') ."\n"; +echo 'Next Week: '. date('Y-m-d', $nextWeek) ."\n"; +?> +]]> + </programlisting> + &example.outputs.similar; + <screen> +<![CDATA[ +Now: 2005-03-30 +Next Week: 2005-04-07 +]]> + </screen> + </example> + </para> + <para> + ²Î¼û <function>date</function> ºÍ <function>microtime</function>¡£ + </para> + </refsect1> +</refentry> <!-- Keep this comment at the end of the file Local variables: