mazzanet Fri Jun 3 04:46:17 2005 EDT
Modified files: /phpdoc/en/reference/datetime/functions mktime.xml Log: Fix 33223 and move to new doc style
http://cvs.php.net/diff.php/phpdoc/en/reference/datetime/functions/mktime.xml?r1=1.16&r2=1.17&ty=u Index: phpdoc/en/reference/datetime/functions/mktime.xml diff -u phpdoc/en/reference/datetime/functions/mktime.xml:1.16 phpdoc/en/reference/datetime/functions/mktime.xml:1.17 --- phpdoc/en/reference/datetime/functions/mktime.xml:1.16 Sun Apr 24 19:50:58 2005 +++ phpdoc/en/reference/datetime/functions/mktime.xml Fri Jun 3 04:46:16 2005 @@ -1,13 +1,14 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.16 $ --> +<!-- $Revision: 1.17 $ --> <!-- splitted from ./en/functions/datetime.xml, last change in rev 1.2 --> <refentry id="function.mktime"> <refnamediv> <refname>mktime</refname> <refpurpose>Get Unix timestamp for a date</refpurpose> </refnamediv> - <refsect1> - <title>Description</title> + + <refsect1 role="description"> + &reftitle.description; <methodsynopsis> <type>int</type><methodname>mktime</methodname> <methodparam choice="opt"><type>int</type><parameter>hour</parameter></methodparam> @@ -19,13 +20,6 @@ <methodparam choice="opt"><type>int</type><parameter>is_dst</parameter></methodparam> </methodsynopsis> <para> - <emphasis>Warning:</emphasis> 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> Returns the Unix timestamp corresponding to the arguments given. This timestamp is a long integer containing the number of seconds between the Unix Epoch (January 1 1970 00:00:00 GMT) and the time @@ -36,33 +30,129 @@ arguments thus omitted will be set to the current value according to the local date and time. </para> + </refsect1> + + <refsect1 role="parameters"> + &reftitle.parameters; <para> - <parameter>is_dst</parameter> can be set to 1 if the time is - during daylight savings time (DST), 0 if it is not, or -1 (the default) - if it is unknown whether the time is within daylight savings time - or not. If it's unknown, PHP tries to figure it out itself. This can - cause unexpected (but not incorrect) results. + <variablelist> + <varlistentry> + <term><parameter>hour</parameter></term> + <listitem> + <para> + The number of the hour. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>minute</parameter></term> + <listitem> + <para> + The number of the minute. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>second</parameter></term> + <listitem> + <para> + The number of seconds past the minute. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>month</parameter></term> + <listitem> + <para> + The number of the month. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>day</parameter></term> + <listitem> + <para> + The number of the day. + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>year</parameter></term> + <listitem> + <para> + The number of the year, may be a two or four digit value, + with values between 0-69 mapping to 2000-2069 and 70-99 to + 1970-1999 (on systems where time_t is a 32bit signed integer, as + most common today, the valid range for <parameter>year</parameter> + is somewhere between 1901 and 2038). + </para> + </listitem> + </varlistentry> + <varlistentry> + <term><parameter>is_dst</parameter></term> + <listitem> + <para> + This parameter can be set to 1 if the time is during daylight savings time (DST), + 0 if it is not, or -1 (the default) if it is unknown whether the time is within + daylight savings time or not. If it's unknown, PHP tries to figure it out itself. + This can cause unexpected (but not incorrect) results. + Some times are invalid if DST is enabled on the system PHP is running on or + <parameter>is_dst</parameter> is set to 1. If DST is enabled in e.g. 2:00, all times + between 2:00 and 3:00 are invalid and <function>mktime</function> returns an undefined + (usually negative) value. + Some systems (e.g. Solaris 8) enable DST at midnight so time 0:30 of the day when DST + is enabled is evaluated as 23:30 of the previous day. + </para> + </listitem> + </varlistentry> + </variablelist> + </para> + </refsect1> + + + <refsect1 role="returnvalues"> + &reftitle.returnvalues; + <para> + <function>mktime</function> returns the Unix timestamp of the arguments + given. + If the arguments are invalid (eg. if the year, month and day are all 0), the + function returns <literal>-1</literal>. </para> + </refsect1> + + <refsect1 role="changelog"> + &reftitle.changelog; <para> - Some times are invalid if DST is enabled on the system PHP is running on - or <parameter>is_dst</parameter> is set to 1. If DST is enabled in e.g. - 2:00, all times between 2:00 and 3:00 are invalid and - <function>mktime</function> returns an undefined (usually negative) value. - Some systems (e.g. Solaris 8) enable DST at midnight so time 0:30 - of the day when DST is enabled is evaluated as 23:30 of the previous day. + <informaltable> + <tgroup cols="2"> + <thead> + <row> + <entry>&Version;</entry> + <entry>&Description;</entry> + </row> + </thead> + <tbody> + <row> + <entry>3.0.10</entry> + <entry>Added <parameter>is_dst</parameter> parameter</entry> + </row> + </tbody> + </tgroup> + </informaltable> </para> - <note> - <para> - <parameter>is_dst</parameter> was added in 3.0.10. - </para> - </note> + </refsect1> + + <refsect1 role="examples"> + &reftitle.examples; <para> - <function>mktime</function> is useful for doing date arithmetic - and validation, as it will automatically calculate the correct - value for out-of-range input. For example, each of the following - lines produces the string "Jan-01-1998". <example> <title><function>mktime</function> example</title> + <para> + <function>mktime</function> is useful for doing date arithmetic + and validation, as it will automatically calculate the correct + value for out-of-range input. For example, each of the following + lines produces the string "Jan-01-1998". + </para> <programlisting role="php"> <![CDATA[ <?php @@ -74,34 +164,20 @@ ]]> </programlisting> </example> - <parameter>Year</parameter> may be a two or four digit value, - with values between 0-69 mapping to 2000-2069 and 70-99 to - 1970-1999 (on systems where time_t is a 32bit signed integer, as - most common today, the valid range for - <parameter>year</parameter> is somewhere between 1901 and 2038). - </para> - <para> - <note> - <title>Windows</title> - <simpara> - Negative timestamps are not supported under any known version - of Windows. Therefore the range of valid years includes only 1970 - through 2038. - </simpara> - </note> - </para> - <para> - The last day of any given month can be expressed as the "0" day - of the next month, not the -1 day. Both of the following examples - will produce the string "The last day in Feb 2000 is: 29". + </para> + <para> <example> <title>Last day of next month</title> + <para> + The last day of any given month can be expressed as the "0" day + of the next month, not the -1 day. Both of the following examples + will produce the string "The last day in Feb 2000 is: 29". + </para> <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); ?> @@ -109,14 +185,27 @@ </programlisting> </example> </para> - <simpara> - Date with year, month and day equal to zero is considered illegal - (otherwise it what be regarded as 30.11.1999, which would be strange - behavior). - </simpara> + </refsect1> + + <refsect1 role="notes"> + &reftitle.notes; + <caution> + <para> + Negative timestamps are not supported under any known version + of Windows. Therefore the range of valid years includes only 1970 + through 2038. + </para> + </caution> + </refsect1> + + <refsect1 role="seealso"> + &reftitle.seealso; <para> - See also <function>gmmktime</function>, - <function>date</function> and <function>time</function>. + <simplelist> + <member><function>gmmktime</function></member> + <member><function>date</function></member> + <member><function>time</function></member> + </simplelist> </para> </refsect1> </refentry>