WS, preparation for the new doc style

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@185012 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Philip Olson 2005-04-24 23:50:58 +00:00
parent a0fb692b2c
commit 8c1cd0f8fb
16 changed files with 1577 additions and 1601 deletions

View file

@ -1,68 +1,68 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.6 $ -->
<!-- $Revision: 1.7 $ -->
<!-- splitted from ./en/functions/datetime.xml, last change in rev 1.2 -->
<refentry id="function.checkdate">
<refnamediv>
<refname>checkdate</refname>
<refpurpose>Validate a Gregorian date</refpurpose>
</refnamediv>
<refsect1>
<title>Description</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>
Returns &true; if the date given is valid; otherwise returns &false;.
Checks the validity of the date formed by the arguments. A date
is considered valid if:
<itemizedlist>
<listitem>
<simpara>
year is between 1 and 32767 inclusive
</simpara>
</listitem>
<listitem>
<simpara>
month is between 1 and 12 inclusive
</simpara>
</listitem>
<listitem>
<simpara>
<parameter>Day</parameter> is within the allowed number of
days for the given <parameter>month</parameter>. Leap
<parameter>year</parameter>s are taken into consideration.
</simpara>
</listitem>
</itemizedlist>
</para>
<para>
<example>
<title><function>checkdate</function> example</title>
<programlisting role="php">
<refentry id="function.checkdate">
<refnamediv>
<refname>checkdate</refname>
<refpurpose>Validate a Gregorian date</refpurpose>
</refnamediv>
<refsect1>
<title>Description</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>
Returns &true; if the date given is valid; otherwise returns &false;.
Checks the validity of the date formed by the arguments. A date
is considered valid if:
<itemizedlist>
<listitem>
<simpara>
year is between 1 and 32767 inclusive
</simpara>
</listitem>
<listitem>
<simpara>
month is between 1 and 12 inclusive
</simpara>
</listitem>
<listitem>
<simpara>
<parameter>Day</parameter> is within the allowed number of
days for the given <parameter>month</parameter>. Leap
<parameter>year</parameter>s are taken into consideration.
</simpara>
</listitem>
</itemizedlist>
</para>
<para>
<example>
<title><function>checkdate</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
var_dump(checkdate(12, 31, 2000));
var_dump(checkdate(2, 29, 2001));
?>
]]>
</programlisting>
&example.outputs;
<screen>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
bool(true)
bool(false)
]]>
</screen>
</example>
</para>
<para>
See also <function>mktime</function> and <function>strtotime</function>.
</para>
</refsect1>
</refentry>
</screen>
</example>
</para>
<para>
See also <function>mktime</function> and <function>strtotime</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,74 +1,74 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.4 $ -->
<refentry id="function.date-sunrise">
<refnamediv>
<refname>date_sunrise</refname>
<refpurpose>
Returns time of sunrise for a given day and location
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>mixed</type><methodname>date_sunrise</methodname>
<methodparam><type>int</type><parameter>timestamp</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>format</parameter></methodparam>
<methodparam choice="opt"><type>float</type><parameter>latitude</parameter></methodparam>
<methodparam choice="opt"><type>float</type><parameter>longitude</parameter></methodparam>
<methodparam choice="opt"><type>float</type><parameter>zenith</parameter></methodparam>
<methodparam choice="opt"><type>float</type><parameter>gmt_offset</parameter></methodparam>
</methodsynopsis>
<para>
<function>date_sunrise</function> returns the sunrise time for a given
day (specified as a <parameter>timestamp</parameter>) and location. The
<parameter>latitude</parameter>, <parameter>longitude</parameter> and
<parameter>zenith</parameter> parameters default to the
<literal>date.default_latitude</literal>,
<literal>date.default_longitude</literal> and
<literal>date.sunrise_zenith</literal> configuration options,
respectively.
</para>
<para>
The <parameter>latitude</parameter> defaults to North. So, if you want to
specify a South value, you must pass a negative value. The same note
applies to <parameter>longitude</parameter>, which defaults to East.
</para>
<para>
The <parameter>gmt_offset</parameter> parameter is specified in hours.
</para>
<table>
<title><parameter>format</parameter> constants</title>
<tgroup cols="2">
<thead>
<row>
<entry>constant</entry>
<entry>description</entry>
<entry>example</entry>
</row>
</thead>
<tbody>
<row>
<entry>SUNFUNCS_RET_STRING</entry>
<entry>returns the sunset time as <type>string</type></entry>
<entry>16:46</entry>
</row>
<row>
<entry>SUNFUNCS_RET_DOUBLE</entry>
<entry>returns the result as <type>float</type></entry>
<entry>16.78243132</entry>
</row>
<row>
<entry>SUNFUNCS_RET_TIMESTAMP</entry>
<entry>returns the sunset time as an <type>integer</type> (timestamp)</entry>
<entry>1095034606</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
<example>
<title><function>date_sunrise</function> example</title>
<programlisting role="php">
<!-- $Revision: 1.5 $ -->
<refentry id="function.date-sunrise">
<refnamediv>
<refname>date_sunrise</refname>
<refpurpose>
Returns time of sunrise for a given day and location
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>mixed</type><methodname>date_sunrise</methodname>
<methodparam><type>int</type><parameter>timestamp</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>format</parameter></methodparam>
<methodparam choice="opt"><type>float</type><parameter>latitude</parameter></methodparam>
<methodparam choice="opt"><type>float</type><parameter>longitude</parameter></methodparam>
<methodparam choice="opt"><type>float</type><parameter>zenith</parameter></methodparam>
<methodparam choice="opt"><type>float</type><parameter>gmt_offset</parameter></methodparam>
</methodsynopsis>
<para>
<function>date_sunrise</function> returns the sunrise time for a given
day (specified as a <parameter>timestamp</parameter>) and location. The
<parameter>latitude</parameter>, <parameter>longitude</parameter> and
<parameter>zenith</parameter> parameters default to the
<literal>date.default_latitude</literal>,
<literal>date.default_longitude</literal> and
<literal>date.sunrise_zenith</literal> configuration options,
respectively.
</para>
<para>
The <parameter>latitude</parameter> defaults to North. So, if you want to
specify a South value, you must pass a negative value. The same note
applies to <parameter>longitude</parameter>, which defaults to East.
</para>
<para>
The <parameter>gmt_offset</parameter> parameter is specified in hours.
</para>
<table>
<title><parameter>format</parameter> constants</title>
<tgroup cols="2">
<thead>
<row>
<entry>constant</entry>
<entry>description</entry>
<entry>example</entry>
</row>
</thead>
<tbody>
<row>
<entry>SUNFUNCS_RET_STRING</entry>
<entry>returns the sunset time as <type>string</type></entry>
<entry>16:46</entry>
</row>
<row>
<entry>SUNFUNCS_RET_DOUBLE</entry>
<entry>returns the result as <type>float</type></entry>
<entry>16.78243132</entry>
</row>
<row>
<entry>SUNFUNCS_RET_TIMESTAMP</entry>
<entry>returns the sunset time as an <type>integer</type> (timestamp)</entry>
<entry>1095034606</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
<example>
<title><function>date_sunrise</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
@ -83,20 +83,20 @@ echo date("D M d Y"). ', sunrise time : ' .date_sunrise(time(), SUNFUNCS_RET_STR
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
Mon Dec 20 2004, sunrise time : 08:54
]]>
</screen>
</example>
</para>
<para>
See also <function>date_sunset</function>.
</para>
</refsect1>
</refentry>
]]>
</screen>
</example>
</para>
<para>
See also <function>date_sunset</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,74 +1,74 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.4 $ -->
<refentry id="function.date-sunset">
<refnamediv>
<refname>date_sunset</refname>
<refpurpose>
Returns time of sunset for a given day and location
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>mixed</type><methodname>date_sunset</methodname>
<methodparam><type>int</type><parameter>timestamp</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>format</parameter></methodparam>
<methodparam choice="opt"><type>float</type><parameter>latitude</parameter></methodparam>
<methodparam choice="opt"><type>float</type><parameter>longitude</parameter></methodparam>
<methodparam choice="opt"><type>float</type><parameter>zenith</parameter></methodparam>
<methodparam choice="opt"><type>float</type><parameter>gmt_offset</parameter></methodparam>
</methodsynopsis>
<para>
<function>date_sunset</function> returns the sunset time for a given day
(specified as a <parameter>timestamp</parameter>) and location. The
<parameter>latitude</parameter>, <parameter>longitude</parameter> and
<parameter>zenith</parameter> parameters default to the
<literal>date.default_latitude</literal>,
<literal>date.default_longitude</literal> and
<literal>date.sunset_zenith</literal> configuration options,
respectively.
</para>
<para>
The <parameter>latitude</parameter> defaults to North. So, if you want to
specify a South value, you must pass a negative value. The same note
applies to <parameter>longitude</parameter>, which defaults to East.
</para>
<para>
The <parameter>gmt_offset</parameter> parameter is specified in hours.
</para>
<table>
<title><parameter>format</parameter> constants</title>
<tgroup cols="2">
<thead>
<row>
<entry>constant</entry>
<entry>description</entry>
<entry>example</entry>
</row>
</thead>
<tbody>
<row>
<entry>SUNFUNCS_RET_STRING</entry>
<entry>returns the sunset time as <type>string</type></entry>
<entry>16:46</entry>
</row>
<row>
<entry>SUNFUNCS_RET_DOUBLE</entry>
<entry>returns the result as <type>float</type></entry>
<entry>16.78243132</entry>
</row>
<row>
<entry>SUNFUNCS_RET_TIMESTAMP</entry>
<entry>returns the sunset time as an <type>integer</type> (timestamp)</entry>
<entry>1095034606</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
<example>
<title><function>date_sunset</function> example</title>
<programlisting role="php">
<!-- $Revision: 1.5 $ -->
<refentry id="function.date-sunset">
<refnamediv>
<refname>date_sunset</refname>
<refpurpose>
Returns time of sunset for a given day and location
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>mixed</type><methodname>date_sunset</methodname>
<methodparam><type>int</type><parameter>timestamp</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>format</parameter></methodparam>
<methodparam choice="opt"><type>float</type><parameter>latitude</parameter></methodparam>
<methodparam choice="opt"><type>float</type><parameter>longitude</parameter></methodparam>
<methodparam choice="opt"><type>float</type><parameter>zenith</parameter></methodparam>
<methodparam choice="opt"><type>float</type><parameter>gmt_offset</parameter></methodparam>
</methodsynopsis>
<para>
<function>date_sunset</function> returns the sunset time for a given day
(specified as a <parameter>timestamp</parameter>) and location. The
<parameter>latitude</parameter>, <parameter>longitude</parameter> and
<parameter>zenith</parameter> parameters default to the
<literal>date.default_latitude</literal>,
<literal>date.default_longitude</literal> and
<literal>date.sunset_zenith</literal> configuration options,
respectively.
</para>
<para>
The <parameter>latitude</parameter> defaults to North. So, if you want to
specify a South value, you must pass a negative value. The same note
applies to <parameter>longitude</parameter>, which defaults to East.
</para>
<para>
The <parameter>gmt_offset</parameter> parameter is specified in hours.
</para>
<table>
<title><parameter>format</parameter> constants</title>
<tgroup cols="2">
<thead>
<row>
<entry>constant</entry>
<entry>description</entry>
<entry>example</entry>
</row>
</thead>
<tbody>
<row>
<entry>SUNFUNCS_RET_STRING</entry>
<entry>returns the sunset time as <type>string</type></entry>
<entry>16:46</entry>
</row>
<row>
<entry>SUNFUNCS_RET_DOUBLE</entry>
<entry>returns the result as <type>float</type></entry>
<entry>16.78243132</entry>
</row>
<row>
<entry>SUNFUNCS_RET_TIMESTAMP</entry>
<entry>returns the sunset time as an <type>integer</type> (timestamp)</entry>
<entry>1095034606</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
<example>
<title><function>date_sunset</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
@ -83,20 +83,20 @@ echo date("D M d Y"). ', sunset time : ' .date_sunset(time(), SUNFUNCS_RET_STRIN
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
Mon Dec 20 2004, sunset time : 18:13
]]>
</screen>
</example>
</para>
<para>
See also <function>date_sunrise</function>.
</para>
</refsect1>
</refentry>
]]>
</screen>
</example>
</para>
<para>
See also <function>date_sunrise</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,269 +1,267 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.17 $ -->
<!-- $Revision: 1.18 $ -->
<!-- splitted from ./en/functions/datetime.xml, last change in rev 1.2 -->
<refentry id="function.date">
<refnamediv>
<refname>date</refname>
<refpurpose>Format a local time/date</refpurpose>
</refnamediv>
<refsect1>
<title>Description</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>
<refentry id="function.date">
<refnamediv>
<refname>date</refname>
<refpurpose>Format a local time/date</refpurpose>
</refnamediv>
<refsect1>
<title>Description</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>
Returns a string formatted according to the given format string using the
given integer <parameter>timestamp</parameter> or the current local time
if no timestamp is given. In other words, <parameter>timestamp</parameter>
is optional and defaults to the value of <function>time</function>.
<note>
<para>
Returns a string formatted according to the given format string using the
given integer <parameter>timestamp</parameter> or the current local time
if no timestamp is given. In other words, <parameter>timestamp</parameter>
is optional and defaults to the value of <function>time</function>.
<note>
<para>
The valid range of a timestamp is typically from Fri, 13 Dec
1901 20:45:54 GMT to Tue, 19 Jan 2038 03:14:07 GMT. (These are
the dates that correspond to the minimum and maximum values for
a 32-bit signed integer). On Windows this range is limited from
01-01-1970 to 19-01-2038.
</para>
</note>
<note>
<para>
To generate a timestamp from a string representation of the date, you
may be able to use <function>strtotime</function>. Additionally, some
databases have functions to convert their date formats into timestamps
(such as MySQL's <ulink url="&url.mysql.docs.date;">UNIX_TIMESTAMP</ulink>
function).
</para>
</note>
The valid range of a timestamp is typically from Fri, 13 Dec
1901 20:45:54 GMT to Tue, 19 Jan 2038 03:14:07 GMT. (These are
the dates that correspond to the minimum and maximum values for
a 32-bit signed integer). On Windows this range is limited from
01-01-1970 to 19-01-2038.
</para>
</note>
<note>
<para>
<table>
<title>The following characters are recognized in the
<parameter>format</parameter> parameter string</title>
<tgroup cols="3">
<thead>
<row>
<entry><parameter>format</parameter> character</entry>
<entry>Description</entry>
<entry>Example returned values</entry>
</row>
</thead>
<tbody>
<row>
<entry align="center"><emphasis>Day</emphasis></entry>
<entry>---</entry>
<entry>---</entry>
</row>
<row>
<entry><literal>d</literal></entry>
<entry>Day of the month, 2 digits with leading zeros</entry>
<entry><literal>01</literal> to <literal>31</literal></entry>
</row>
<row>
<entry><literal>D</literal></entry>
<entry>A textual representation of a day, three letters</entry>
<entry><literal>Mon</literal> through <literal>Sun</literal></entry>
</row>
<row>
<entry><literal>j</literal></entry>
<entry>Day of the month without leading zeros</entry>
<entry><literal>1</literal> to <literal>31</literal></entry>
</row>
<row>
<entry><literal>l</literal> (lowercase 'L')</entry>
<entry>A full textual representation of the day of the week</entry>
<entry><literal>Sunday</literal> through <literal>Saturday</literal></entry>
</row>
<row>
<entry><literal>S</literal></entry>
<entry>English ordinal suffix for the day of the month, 2 characters</entry>
<entry>
<literal>st</literal>, <literal>nd</literal>, <literal>rd</literal> or
<literal>th</literal>. Works well with <literal>j</literal>
</entry>
</row>
<row>
<entry><literal>w</literal></entry>
<entry>Numeric representation of the day of the week</entry>
<entry><literal>0</literal> (for Sunday) through <literal>6</literal> (for Saturday)</entry>
</row>
<row>
<entry><literal>z</literal></entry>
<entry>The day of the year (starting from 0)</entry>
<entry><literal>0</literal> through <literal>365</literal></entry>
</row>
<row>
<entry align="center"><emphasis>Week</emphasis></entry>
<entry>---</entry>
<entry>---</entry>
</row>
<row>
<entry><literal>W</literal></entry>
<entry>ISO-8601 week number of year, weeks starting on Monday (added in PHP 4.1.0)</entry>
<entry>Example: <literal>42</literal> (the 42nd week in the year)</entry>
</row>
<row>
<entry align="center"><emphasis>Month</emphasis></entry>
<entry>---</entry>
<entry>---</entry>
</row>
<row>
<entry><literal>F</literal></entry>
<entry>A full textual representation of a month, such as January or March</entry>
<entry><literal>January</literal> through <literal>December</literal></entry>
</row>
<row>
<entry><literal>m</literal></entry>
<entry>Numeric representation of a month, with leading zeros</entry>
<entry><literal>01</literal> through <literal>12</literal></entry>
</row>
<row>
<entry><literal>M</literal></entry>
<entry>A short textual representation of a month, three letters</entry>
<entry><literal>Jan</literal> through <literal>Dec</literal></entry>
</row>
<row>
<entry><literal>n</literal></entry>
<entry>Numeric representation of a month, without leading zeros</entry>
<entry><literal>1</literal> through <literal>12</literal></entry>
</row>
<row>
<entry><literal>t</literal></entry>
<entry>Number of days in the given month</entry>
<entry><literal>28</literal> through <literal>31</literal></entry>
</row>
<row>
<entry align="center"><emphasis>Year</emphasis></entry>
<entry>---</entry>
<entry>---</entry>
</row>
<row>
<entry><literal>L</literal></entry>
<entry>Whether it's a leap year</entry>
<entry><literal>1</literal> if it is a leap year, <literal>0</literal> otherwise.</entry>
</row>
<row>
<entry><literal>Y</literal></entry>
<entry>A full numeric representation of a year, 4 digits</entry>
<entry>Examples: <literal>1999</literal> or <literal>2003</literal></entry>
</row>
<row>
<entry><literal>y</literal></entry>
<entry>A two digit representation of a year</entry>
<entry>Examples: <literal>99</literal> or <literal>03</literal></entry>
</row>
<row>
<entry align="center"><emphasis>Time</emphasis></entry>
<entry>---</entry>
<entry>---</entry>
</row>
<row>
<entry><literal>a</literal></entry>
<entry>Lowercase Ante meridiem and Post meridiem</entry>
<entry><literal>am</literal> or <literal>pm</literal></entry>
</row>
<row>
<entry><literal>A</literal></entry>
<entry>Uppercase Ante meridiem and Post meridiem</entry>
<entry><literal>AM</literal> or <literal>PM</literal></entry>
</row>
<row>
<entry><literal>B</literal></entry>
<entry>Swatch Internet time</entry>
<entry><literal>000</literal> through <literal>999</literal></entry>
</row>
<row>
<entry><literal>g</literal></entry>
<entry>12-hour format of an hour without leading zeros</entry>
<entry><literal>1</literal> through <literal>12</literal></entry>
</row>
<row>
<entry><literal>G</literal></entry>
<entry>24-hour format of an hour without leading zeros</entry>
<entry><literal>0</literal> through <literal>23</literal></entry>
</row>
<row>
<entry><literal>h</literal></entry>
<entry>12-hour format of an hour with leading zeros</entry>
<entry><literal>01</literal> through <literal>12</literal></entry>
</row>
<row>
<entry><literal>H</literal></entry>
<entry>24-hour format of an hour with leading zeros</entry>
<entry><literal>00</literal> through <literal>23</literal></entry>
</row>
<row>
<entry><literal>i</literal></entry>
<entry>Minutes with leading zeros</entry>
<entry><literal>00</literal> to <literal>59</literal></entry>
</row>
<row>
<entry><literal>s</literal></entry>
<entry>Seconds, with leading zeros</entry>
<entry><literal>00</literal> through <literal>59</literal></entry>
</row>
<row>
<entry align="center"><emphasis>Timezone</emphasis></entry>
<entry>---</entry>
<entry>---</entry>
</row>
<row>
<entry><literal>I</literal> (capital i)</entry>
<entry>Whether or not the date is in daylights savings time</entry>
<entry><literal>1</literal> if Daylight Savings Time, <literal>0</literal> otherwise.</entry>
</row>
<row>
<entry><literal>O</literal></entry>
<entry>Difference to Greenwich time (GMT) in hours</entry>
<entry>Example: <literal>+0200</literal></entry>
</row>
<row>
<entry><literal>T</literal></entry>
<entry>Timezone setting of this machine</entry>
<entry>Examples: <literal>EST</literal>, <literal>MDT</literal> ...</entry>
</row>
<row>
<entry><literal>Z</literal></entry>
<entry>Timezone offset in seconds. The offset for timezones west of UTC is always
negative, and for those east of UTC is always positive.</entry>
<entry><literal>-43200</literal> through <literal>43200</literal></entry>
</row>
<row>
<entry align="center"><emphasis>Full Date/Time</emphasis></entry>
<entry>---</entry>
<entry>---</entry>
</row>
<row>
<entry><literal>c</literal></entry>
<entry>ISO 8601 date (added in PHP 5)</entry>
<entry>2004-02-12T15:19:21+00:00</entry>
</row>
<row>
<entry><literal>r</literal></entry>
<entry><ulink url="&url.rfc;2822">RFC 2822</ulink> formatted date</entry>
<entry>Example: <literal>Thu, 21 Dec 2000 16:01:07 +0200</literal></entry>
</row>
<row>
<entry><literal>U</literal></entry>
<entry>Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)</entry>
<entry>See also <function>time</function></entry>
</row>
</tbody>
</tgroup>
</table>
To generate a timestamp from a string representation of the date, you
may be able to use <function>strtotime</function>. Additionally, some
databases have functions to convert their date formats into timestamps
(such as MySQL's <ulink url="&url.mysql.docs.date;">UNIX_TIMESTAMP</ulink>
function).
</para>
<para>
Unrecognized characters in the format string will be printed
as-is. The <literal>Z</literal> format will always return
<literal>0</literal> when using <function>gmdate</function>.
</para>
<para>
<example>
<title><function>date</function> examples</title>
<programlisting role="php">
</note>
</para>
<para>
<table>
<title>The following characters are recognized in the
<parameter>format</parameter> parameter string</title>
<tgroup cols="3">
<thead>
<row>
<entry><parameter>format</parameter> character</entry>
<entry>Description</entry>
<entry>Example returned values</entry>
</row>
</thead>
<tbody>
<row>
<entry align="center"><emphasis>Day</emphasis></entry>
<entry>---</entry>
<entry>---</entry>
</row>
<row>
<entry><literal>d</literal></entry>
<entry>Day of the month, 2 digits with leading zeros</entry>
<entry><literal>01</literal> to <literal>31</literal></entry>
</row>
<row>
<entry><literal>D</literal></entry>
<entry>A textual representation of a day, three letters</entry>
<entry><literal>Mon</literal> through <literal>Sun</literal></entry>
</row>
<row>
<entry><literal>j</literal></entry>
<entry>Day of the month without leading zeros</entry>
<entry><literal>1</literal> to <literal>31</literal></entry>
</row>
<row>
<entry><literal>l</literal> (lowercase 'L')</entry>
<entry>A full textual representation of the day of the week</entry>
<entry><literal>Sunday</literal> through <literal>Saturday</literal></entry>
</row>
<row>
<entry><literal>S</literal></entry>
<entry>English ordinal suffix for the day of the month, 2 characters</entry>
<entry>
<literal>st</literal>, <literal>nd</literal>, <literal>rd</literal> or
<literal>th</literal>. Works well with <literal>j</literal>
</entry>
</row>
<row>
<entry><literal>w</literal></entry>
<entry>Numeric representation of the day of the week</entry>
<entry><literal>0</literal> (for Sunday) through <literal>6</literal> (for Saturday)</entry>
</row>
<row>
<entry><literal>z</literal></entry>
<entry>The day of the year (starting from 0)</entry>
<entry><literal>0</literal> through <literal>365</literal></entry>
</row>
<row>
<entry align="center"><emphasis>Week</emphasis></entry>
<entry>---</entry>
<entry>---</entry>
</row>
<row>
<entry><literal>W</literal></entry>
<entry>ISO-8601 week number of year, weeks starting on Monday (added in PHP 4.1.0)</entry>
<entry>Example: <literal>42</literal> (the 42nd week in the year)</entry>
</row>
<row>
<entry align="center"><emphasis>Month</emphasis></entry>
<entry>---</entry>
<entry>---</entry>
</row>
<row>
<entry><literal>F</literal></entry>
<entry>A full textual representation of a month, such as January or March</entry>
<entry><literal>January</literal> through <literal>December</literal></entry>
</row>
<row>
<entry><literal>m</literal></entry>
<entry>Numeric representation of a month, with leading zeros</entry>
<entry><literal>01</literal> through <literal>12</literal></entry>
</row>
<row>
<entry><literal>M</literal></entry>
<entry>A short textual representation of a month, three letters</entry>
<entry><literal>Jan</literal> through <literal>Dec</literal></entry>
</row>
<row>
<entry><literal>n</literal></entry>
<entry>Numeric representation of a month, without leading zeros</entry>
<entry><literal>1</literal> through <literal>12</literal></entry>
</row>
<row>
<entry><literal>t</literal></entry>
<entry>Number of days in the given month</entry>
<entry><literal>28</literal> through <literal>31</literal></entry>
</row>
<row>
<entry align="center"><emphasis>Year</emphasis></entry>
<entry>---</entry>
<entry>---</entry>
</row>
<row>
<entry><literal>L</literal></entry>
<entry>Whether it's a leap year</entry>
<entry><literal>1</literal> if it is a leap year, <literal>0</literal> otherwise.</entry>
</row>
<row>
<entry><literal>Y</literal></entry>
<entry>A full numeric representation of a year, 4 digits</entry>
<entry>Examples: <literal>1999</literal> or <literal>2003</literal></entry>
</row>
<row>
<entry><literal>y</literal></entry>
<entry>A two digit representation of a year</entry>
<entry>Examples: <literal>99</literal> or <literal>03</literal></entry>
</row>
<row>
<entry align="center"><emphasis>Time</emphasis></entry>
<entry>---</entry>
<entry>---</entry>
</row>
<row>
<entry><literal>a</literal></entry>
<entry>Lowercase Ante meridiem and Post meridiem</entry>
<entry><literal>am</literal> or <literal>pm</literal></entry>
</row>
<row>
<entry><literal>A</literal></entry>
<entry>Uppercase Ante meridiem and Post meridiem</entry>
<entry><literal>AM</literal> or <literal>PM</literal></entry>
</row>
<row>
<entry><literal>B</literal></entry>
<entry>Swatch Internet time</entry>
<entry><literal>000</literal> through <literal>999</literal></entry>
</row>
<row>
<entry><literal>g</literal></entry>
<entry>12-hour format of an hour without leading zeros</entry>
<entry><literal>1</literal> through <literal>12</literal></entry>
</row>
<row>
<entry><literal>G</literal></entry>
<entry>24-hour format of an hour without leading zeros</entry>
<entry><literal>0</literal> through <literal>23</literal></entry>
</row>
<row>
<entry><literal>h</literal></entry>
<entry>12-hour format of an hour with leading zeros</entry>
<entry><literal>01</literal> through <literal>12</literal></entry>
</row>
<row>
<entry><literal>H</literal></entry>
<entry>24-hour format of an hour with leading zeros</entry>
<entry><literal>00</literal> through <literal>23</literal></entry>
</row>
<row>
<entry><literal>i</literal></entry>
<entry>Minutes with leading zeros</entry>
<entry><literal>00</literal> to <literal>59</literal></entry>
</row>
<row>
<entry><literal>s</literal></entry>
<entry>Seconds, with leading zeros</entry>
<entry><literal>00</literal> through <literal>59</literal></entry>
</row>
<row>
<entry align="center"><emphasis>Timezone</emphasis></entry>
<entry>---</entry>
<entry>---</entry>
</row>
<row>
<entry><literal>I</literal> (capital i)</entry>
<entry>Whether or not the date is in daylights savings time</entry>
<entry><literal>1</literal> if Daylight Savings Time, <literal>0</literal> otherwise.</entry>
</row>
<row>
<entry><literal>O</literal></entry>
<entry>Difference to Greenwich time (GMT) in hours</entry>
<entry>Example: <literal>+0200</literal></entry>
</row>
<row>
<entry><literal>T</literal></entry>
<entry>Timezone setting of this machine</entry>
<entry>Examples: <literal>EST</literal>, <literal>MDT</literal> ...</entry>
</row>
<row>
<entry><literal>Z</literal></entry>
<entry>Timezone offset in seconds. The offset for timezones west of UTC is always
negative, and for those east of UTC is always positive.</entry>
<entry><literal>-43200</literal> through <literal>43200</literal></entry>
</row>
<row>
<entry align="center"><emphasis>Full Date/Time</emphasis></entry>
<entry>---</entry>
<entry>---</entry>
</row>
<row>
<entry><literal>c</literal></entry>
<entry>ISO 8601 date (added in PHP 5)</entry>
<entry>2004-02-12T15:19:21+00:00</entry>
</row>
<row>
<entry><literal>r</literal></entry>
<entry><ulink url="&url.rfc;2822">RFC 2822</ulink> formatted date</entry>
<entry>Example: <literal>Thu, 21 Dec 2000 16:01:07 +0200</literal></entry>
</row>
<row>
<entry><literal>U</literal></entry>
<entry>Seconds since the Unix Epoch (January 1 1970 00:00:00 GMT)</entry>
<entry>See also <function>time</function></entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<para>
Unrecognized characters in the format string will be printed
as-is. The <literal>Z</literal> format will always return
<literal>0</literal> when using <function>gmdate</function>.
</para>
<para>
<example>
<title><function>date</function> examples</title>
<programlisting role="php">
<![CDATA[
<?php
// Prints something like: Wednesday
@ -276,36 +274,33 @@ echo date("l dS of F Y h:i:s A");
echo "July 1, 2000 is on a " . date("l", mktime(0, 0, 0, 7, 1, 2000));
?>
]]>
</programlisting>
</example>
</para>
<para>
You can prevent a recognized character in the format string from being
expanded by escaping it with a preceding backslash. If the character with
a backslash is already a special sequence, you may need to also escape
the backslash.
<example>
<title>Escaping characters in <function>date</function></title>
<programlisting role="php">
</programlisting>
</example>
</para>
<para>
You can prevent a recognized character in the format string from being
expanded by escaping it with a preceding backslash. If the character with
a backslash is already a special sequence, you may need to also escape
the backslash.
<example>
<title>Escaping characters in <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>
It is possible to use <function>date</function> and
<function>mktime</function> together to find dates in the future
or the past.
<example>
<title>
<function>date</function> and <function>mktime</function>
example
</title>
<programlisting role="php">
</programlisting>
</example>
</para>
<para>
It is possible to use <function>date</function> and
<function>mktime</function> together to find dates in the future
or the past.
<example>
<title><function>date</function> and <function>mktime</function>example</title>
<programlisting role="php">
<![CDATA[
<?php
$tomorrow = mktime(0, 0, 0, date("m") , date("d")+1, date("Y"));
@ -313,28 +308,26 @@ $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>
This can be more reliable than simply adding or subtracting the number
of seconds in a day or month to a timestamp because of daylight savings
time.
</para>
</note>
</para>
</programlisting>
</example>
<note>
<para>
Some examples of <function>date</function> formatting. Note that
you should escape any other characters, as any which currently
have a special meaning will produce undesirable results, and
other characters may be assigned meaning in future PHP versions.
When escaping, be sure to use single quotes to prevent characters
like \n from becoming newlines.
<example>
<title>
<function>date</function> Formatting
</title>
<programlisting role="php">
This can be more reliable than simply adding or subtracting the number
of seconds in a day or month to a timestamp because of daylight savings
time.
</para>
</note>
</para>
<para>
Some examples of <function>date</function> formatting. Note that
you should escape any other characters, as any which currently
have a special meaning will produce undesirable results, and
other characters may be assigned meaning in future PHP versions.
When escaping, be sure to use single quotes to prevent characters
like \n from becoming newlines.
<example>
<title><function>date</function> Formatting</title>
<programlisting role="php">
<![CDATA[
<?php
// Assuming today is: March 10th, 2001, 5:16:18 pm
@ -350,21 +343,21 @@ $today = date('H:m:s \m \i\s\ \m\o\n\t\h'); // 17:03:17 m is month
$today = date("H:i:s"); // 17:16:17
?>
]]>
</programlisting>
</example>
</para>
<para>
To format dates in other languages, you should use the
<function>setlocale</function> and <function>strftime</function>
functions.
</para>
<para>
See also <function>getlastmod</function>, <function>gmdate</function>,
<function>mktime</function>, <function>strftime</function>
and <function>time</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<para>
To format dates in other languages, you should use the
<function>setlocale</function> and <function>strftime</function>
functions.
</para>
<para>
See also <function>getlastmod</function>, <function>gmdate</function>,
<function>mktime</function>, <function>strftime</function>
and <function>time</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,111 +1,113 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.10 $ -->
<!-- $Revision: 1.11 $ -->
<!-- splitted from ./en/functions/datetime.xml, last change in rev 1.2 -->
<refentry id="function.getdate">
<refnamediv>
<refname>getdate</refname>
<refpurpose>Get date/time information</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>getdate</methodname>
<methodparam choice="opt"><type>int</type><parameter>timestamp</parameter></methodparam>
</methodsynopsis>
<para>
Returns an associative <type>array</type> containing the date
information of the <parameter>timestamp</parameter>, or the current
local time if no <parameter>timestamp</parameter> is given, as the
following associative array elements:
</para>
<para>
<table>
<title>Key elements of the returned associative array</title>
<tgroup cols="3">
<thead>
<row>
<entry>Key</entry>
<entry>Description</entry>
<entry>Example returned values</entry>
</row>
</thead>
<tbody>
<row>
<entry><literal>"seconds"</literal></entry>
<entry>Numeric representation of seconds</entry>
<entry><literal>0</literal> to <literal>59</literal></entry>
</row>
<row>
<entry><literal>"minutes"</literal></entry>
<entry>Numeric representation of minutes</entry>
<entry><literal>0</literal> to <literal>59</literal></entry>
</row>
<row>
<entry><literal>"hours"</literal></entry>
<entry>Numeric representation of hours</entry>
<entry><literal>0</literal> to <literal>23</literal></entry>
</row>
<row>
<entry><literal>"mday"</literal></entry>
<entry>Numeric representation of the day of the month</entry>
<entry><literal>1</literal> to <literal>31</literal></entry>
</row>
<row>
<entry><literal>"wday"</literal></entry>
<entry>Numeric representation of the day of the week</entry>
<entry><literal>0</literal> (for Sunday) through <literal>6</literal> (for Saturday)</entry>
</row>
<row>
<entry><literal>"mon"</literal></entry>
<entry>Numeric representation of a month</entry>
<entry><literal>1</literal> through <literal>12</literal></entry>
</row>
<row>
<entry><literal>"year"</literal></entry>
<entry>A full numeric representation of a year, 4 digits</entry>
<entry>Examples: <literal>1999</literal> or <literal>2003</literal></entry>
</row>
<row>
<entry><literal>"yday"</literal></entry>
<entry>Numeric representation of the day of the year</entry>
<entry><literal>0</literal> through <literal>365</literal></entry>
</row>
<row>
<entry><literal>"weekday"</literal></entry>
<entry>A full textual representation of the day of the week</entry>
<entry><literal>Sunday</literal> through <literal>Saturday</literal></entry>
</row>
<row>
<entry><literal>"month"</literal></entry>
<entry>A full textual representation of a month, such as January or March</entry>
<entry><literal>January</literal> through <literal>December</literal></entry>
</row>
<row>
<entry><literal>0</literal></entry>
<entry>Seconds since the Unix Epoch, similar to the values returned by
<function>time</function> and used by <function>date</function>.</entry>
<entry>System Dependent, typically <literal>-2147483648</literal> through
<literal>2147483647</literal>.</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<para>
<example>
<title>
<function>getdate</function> example
</title>
<programlisting role="php">
<refentry id="function.getdate">
<refnamediv>
<refname>getdate</refname>
<refpurpose>Get date/time information</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>array</type><methodname>getdate</methodname>
<methodparam choice="opt"><type>int</type><parameter>timestamp</parameter></methodparam>
</methodsynopsis>
<para>
Returns an associative <type>array</type> containing the date
information of the <parameter>timestamp</parameter>, or the current
local time if no <parameter>timestamp</parameter> is given, as the
following associative array elements:
</para>
<para>
<table>
<title>Key elements of the returned associative array</title>
<tgroup cols="3">
<thead>
<row>
<entry>Key</entry>
<entry>Description</entry>
<entry>Example returned values</entry>
</row>
</thead>
<tbody>
<row>
<entry><literal>"seconds"</literal></entry>
<entry>Numeric representation of seconds</entry>
<entry><literal>0</literal> to <literal>59</literal></entry>
</row>
<row>
<entry><literal>"minutes"</literal></entry>
<entry>Numeric representation of minutes</entry>
<entry><literal>0</literal> to <literal>59</literal></entry>
</row>
<row>
<entry><literal>"hours"</literal></entry>
<entry>Numeric representation of hours</entry>
<entry><literal>0</literal> to <literal>23</literal></entry>
</row>
<row>
<entry><literal>"mday"</literal></entry>
<entry>Numeric representation of the day of the month</entry>
<entry><literal>1</literal> to <literal>31</literal></entry>
</row>
<row>
<entry><literal>"wday"</literal></entry>
<entry>Numeric representation of the day of the week</entry>
<entry><literal>0</literal> (for Sunday) through <literal>6</literal> (for Saturday)</entry>
</row>
<row>
<entry><literal>"mon"</literal></entry>
<entry>Numeric representation of a month</entry>
<entry><literal>1</literal> through <literal>12</literal></entry>
</row>
<row>
<entry><literal>"year"</literal></entry>
<entry>A full numeric representation of a year, 4 digits</entry>
<entry>Examples: <literal>1999</literal> or <literal>2003</literal></entry>
</row>
<row>
<entry><literal>"yday"</literal></entry>
<entry>Numeric representation of the day of the year</entry>
<entry><literal>0</literal> through <literal>365</literal></entry>
</row>
<row>
<entry><literal>"weekday"</literal></entry>
<entry>A full textual representation of the day of the week</entry>
<entry><literal>Sunday</literal> through <literal>Saturday</literal></entry>
</row>
<row>
<entry><literal>"month"</literal></entry>
<entry>A full textual representation of a month, such as January or March</entry>
<entry><literal>January</literal> through <literal>December</literal></entry>
</row>
<row>
<entry><literal>0</literal></entry>
<entry>
Seconds since the Unix Epoch, similar to the values returned by
<function>time</function> and used by <function>date</function>.
</entry>
<entry>
System Dependent, typically <literal>-2147483648</literal> through
<literal>2147483647</literal>.
</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<para>
<example>
<title><function>getdate</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$today = getdate();
$today = getdate();
print_r($today);
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
Array
(
@ -122,16 +124,16 @@ Array
[0] => 1055901520
)
]]>
</screen>
</example>
</para>
<para>
See also <function>date</function>,
<function>time</function>, and
<function>setlocale</function>.
</para>
</refsect1>
</refentry>
</screen>
</example>
</para>
<para>
See also <function>date</function>,
<function>time</function>, and
<function>setlocale</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,59 +1,57 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.5 $ -->
<!-- $Revision: 1.6 $ -->
<!-- splitted from ./en/functions/datetime.xml, last change in rev 1.2 -->
<refentry id="function.gettimeofday">
<refnamediv>
<refname>gettimeofday</refname>
<refpurpose>Get current time</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>mixed</type><methodname>gettimeofday</methodname>
<methodparam choice="opt"><type>bool</type><parameter>return_float</parameter></methodparam>
</methodsynopsis>
<para>
This is an interface to gettimeofday(2). It returns an
associative array containing the data returned from the system
call.
</para>
<para>
Since PHP 5.1.0 there is an optional parameter,
<parameter>return_float</parameter>, which makes
<function>gettimeofday</function> return a float when it is set to
&true;.
</para>
<para>
Array keys:
<itemizedlist>
<listitem>
<simpara>
"sec" - seconds since the Unix Epoch
</simpara>
</listitem>
<listitem>
<simpara>
"usec" - microseconds
</simpara>
</listitem>
<listitem>
<simpara>
"minuteswest" - minutes west of Greenwich
</simpara>
</listitem>
<listitem>
<simpara>
"dsttime" - type of dst correction
</simpara>
</listitem>
</itemizedlist>
</para>
<para>
<example>
<title>
<function>gettimeofday</function> example
</title>
<programlisting role="php">
<refentry id="function.gettimeofday">
<refnamediv>
<refname>gettimeofday</refname>
<refpurpose>Get current time</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>mixed</type><methodname>gettimeofday</methodname>
<methodparam choice="opt"><type>bool</type><parameter>return_float</parameter></methodparam>
</methodsynopsis>
<para>
This is an interface to gettimeofday(2). It returns an
associative array containing the data returned from the system
call.
</para>
<para>
Since PHP 5.1.0 there is an optional parameter,
<parameter>return_float</parameter>, which makes
<function>gettimeofday</function> return a float when it is set to
&true;.
</para>
<para>
Array keys:
<itemizedlist>
<listitem>
<simpara>
"sec" - seconds since the Unix Epoch
</simpara>
</listitem>
<listitem>
<simpara>
"usec" - microseconds
</simpara>
</listitem>
<listitem>
<simpara>
"minuteswest" - minutes west of Greenwich
</simpara>
</listitem>
<listitem>
<simpara>
"dsttime" - type of dst correction
</simpara>
</listitem>
</itemizedlist>
</para>
<para>
<example>
<title><function>gettimeofday</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
print_r(gettimeofday());
@ -61,9 +59,9 @@ print_r(gettimeofday());
echo gettimeofday(true);
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
Array
(
@ -75,11 +73,11 @@ Array
1073504408.23910
]]>
</screen>
</example>
</para>
</refsect1>
</refentry>
</screen>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,61 +1,61 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.8 $ -->
<!-- $Revision: 1.9 $ -->
<!-- splitted from ./en/functions/datetime.xml, last change in rev 1.2 -->
<refentry id="function.gmdate">
<refnamediv>
<refname>gmdate</refname>
<refpurpose>Format a GMT/UTC date/time</refpurpose>
</refnamediv>
<refsect1>
<title>Description</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>
Identical to the <function>date</function> function except that
the time returned is Greenwich Mean Time (GMT). For example, when
run in Finland (GMT +0200), the first line below prints "Jan 01
1998 00:00:00", while the second prints "Dec 31 1997 22:00:00".
<example>
<title><function>gmdate</function> example</title>
<programlisting role="php">
<refentry id="function.gmdate">
<refnamediv>
<refname>gmdate</refname>
<refpurpose>Format a GMT/UTC date/time</refpurpose>
</refnamediv>
<refsect1>
<title>Description</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>
Identical to the <function>date</function> function except that
the time returned is Greenwich Mean Time (GMT). For example, when
run in Finland (GMT +0200), the first line below prints "Jan 01
1998 00:00:00", while the second prints "Dec 31 1997 22:00:00".
<example>
<title><function>gmdate</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
echo date("M d Y H:i:s", mktime(0, 0, 0, 1, 1, 1998));
echo gmdate("M d Y H:i:s", mktime(0, 0, 0, 1, 1, 1998));
?>
]]>
</programlisting>
</example>
</para>
<note>
<para>
In the Microsoft Windows series of Operating Systems the system
libraries implementing this function are broken, so
<function>gmdate</function> does not support negative values
for the <parameter>timestamp</parameter>.
For details see bug reports:
<ulink url="&url.php.bugs;22620">#22620</ulink>,
<ulink url="&url.php.bugs;22457">#22457</ulink>,
and <ulink url="&url.php.bugs;14391">#14391</ulink>.
</para>
<para>
This problem does not occur in Unix/Linux Operating Systems, as the
system libraries behave as expected.
</para>
<para>
PHP cannot fix broken system libraries. Contact
your OS vendor for a fix to this and similar problems.
</para>
</note>
<para>
See also <function>date</function>, <function>mktime</function>,
<function>gmmktime</function> and <function>strftime</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<note>
<para>
In the Microsoft Windows series of Operating Systems the system
libraries implementing this function are broken, so
<function>gmdate</function> does not support negative values
for the <parameter>timestamp</parameter>.
For details see bug reports:
<ulink url="&url.php.bugs;22620">#22620</ulink>,
<ulink url="&url.php.bugs;22457">#22457</ulink>,
and <ulink url="&url.php.bugs;14391">#14391</ulink>.
</para>
<para>
This problem does not occur in Unix/Linux Operating Systems, as the
system libraries behave as expected.
</para>
<para>
PHP cannot fix broken system libraries. Contact
your OS vendor for a fix to this and similar problems.
</para>
</note>
<para>
See also <function>date</function>, <function>mktime</function>,
<function>gmmktime</function> and <function>strftime</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,60 +1,60 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.7 $ -->
<!-- $Revision: 1.8 $ -->
<!-- splitted from ./en/functions/datetime.xml, last change in rev 1.2 -->
<refentry id="function.gmmktime">
<refnamediv>
<refname>gmmktime</refname>
<refpurpose>Get Unix timestamp for a GMT date</refpurpose>
</refnamediv>
<refsect1>
<title>Description</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>
Identical to <function>mktime</function> except the passed
parameters represents a GMT date.
</para>
<para>
Parameters always represent a GMT date so <parameter>is_dst</parameter>
doesn't influence the result.
</para>
<para>
Like <function>mktime</function>, arguments may be left out in order
from right to left, with any omitted arguments being set to the
current corresponding GMT value.
</para>
<para>
<note>
<simpara>
<function>gmmktime</function> internaly uses <function>mktime</function>
so only times valid in derived local time can be used.
</simpara>
</note>
<example>
<title><function>gmmktime</function> on Windows boundary</title>
<programlisting role="php">
<refentry id="function.gmmktime">
<refnamediv>
<refname>gmmktime</refname>
<refpurpose>Get Unix timestamp for a GMT date</refpurpose>
</refnamediv>
<refsect1>
<title>Description</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>
Identical to <function>mktime</function> except the passed
parameters represents a GMT date.
</para>
<para>
Parameters always represent a GMT date so <parameter>is_dst</parameter>
doesn't influence the result.
</para>
<para>
Like <function>mktime</function>, arguments may be left out in order
from right to left, with any omitted arguments being set to the
current corresponding GMT value.
</para>
<para>
<note>
<simpara>
<function>gmmktime</function> internaly uses <function>mktime</function>
so only times valid in derived local time can be used.
</simpara>
</note>
<example>
<title><function>gmmktime</function> on Windows boundary</title>
<programlisting role="php">
<![CDATA[
<?php
gmmktime(0, 0, 0, 1, 1, 1970); // valid in GMT and west, invalid in east
?>
]]>
</programlisting>
</example>
</para>
<para>
See also <function>mktime</function>,
<function>date</function> and <function>time</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<para>
See also <function>mktime</function>,
<function>date</function> and <function>time</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,29 +1,27 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.7 $ -->
<!-- $Revision: 1.8 $ -->
<!-- splitted from ./en/functions/datetime.xml, last change in rev 1.2 -->
<refentry id="function.gmstrftime">
<refnamediv>
<refname>gmstrftime</refname>
<refpurpose>
Format a GMT/UTC time/date according to locale settings
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</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>
Behaves the same as <function>strftime</function> except that the
time returned is Greenwich Mean Time (GMT). For example, when run
in Eastern Standard Time (GMT -0500), the first line below prints
"Dec 31 1998 20:00:00", while the second prints "Jan 01 1999
01:00:00".
<example>
<title><function>gmstrftime</function> example</title>
<programlisting role="php">
<refentry id="function.gmstrftime">
<refnamediv>
<refname>gmstrftime</refname>
<refpurpose>Format a GMT/UTC time/date according to locale settings</refpurpose>
</refnamediv>
<refsect1>
<title>Description</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>
Behaves the same as <function>strftime</function> except that the
time returned is Greenwich Mean Time (GMT). For example, when run
in Eastern Standard Time (GMT -0500), the first line below prints
"Dec 31 1998 20:00:00", while the second prints "Jan 01 1999
01:00:00".
<example>
<title><function>gmstrftime</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
setlocale(LC_TIME, 'en_US');
@ -31,14 +29,14 @@ 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>
See also <function>strftime</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<para>
See also <function>strftime</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,127 +1,125 @@
<?xml version='1.0' encoding='iso-8859-1'?>
<!-- $Revision: 1.4 $ -->
<refentry id="function.idate">
<refnamediv>
<refname>idate</refname>
<refpurpose>
Format a local time/date as integer
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>idate</methodname>
<methodparam><type>string</type><parameter>format</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>timestamp</parameter></methodparam>
</methodsynopsis>
<para>
Returns a number formatted according to the given format string using the
given integer <parameter>timestamp</parameter> or the current local time
if no timestamp is given. In other words, <parameter>timestamp</parameter>
is optional and defaults to the value of <function>time</function>.
</para>
<para>
Unlike the function <function>date</function>, <function>idate</function>
accepts just one char in the <parameter>format</parameter> parameter.
</para>
<para>
<table>
<title>The following characters are recognized in the
<parameter>format</parameter> parameter string</title>
<tgroup cols="2">
<thead>
<row>
<entry><parameter>format</parameter> character</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><literal>B</literal></entry>
<entry>Swatch Beat/Internet Time</entry>
</row>
<row>
<entry><literal>d</literal></entry>
<entry>Day of the month</entry>
</row>
<row>
<entry><literal>h</literal></entry>
<entry>Hour (12 hour format)</entry>
</row>
<row>
<entry><literal>H</literal></entry>
<entry>Hour (24 hour format)</entry>
</row>
<row>
<entry><literal>i</literal></entry>
<entry>Minutes</entry>
</row>
<row>
<entry><literal>I</literal></entry>
<entry>returns <literal>1</literal> if DST is activated,
<literal>0</literal> otherwise</entry>
</row>
<row>
<entry><literal>L</literal></entry>
<entry>returns <literal>1</literal> for leap year,
<literal>0</literal> otherwise</entry>
</row>
<row>
<entry><literal>m</literal></entry>
<entry>Month number</entry>
</row>
<row>
<entry><literal>s</literal></entry>
<entry>Seconds</entry>
</row>
<row>
<entry><literal>t</literal></entry>
<entry>Days in current month</entry>
</row>
<row>
<entry><literal>U</literal></entry>
<entry>Seconds since the Unix Epoch - January 1 1970 00:00:00 GMT -
this is the same as <function>time</function></entry>
</row>
<row>
<entry><literal>w</literal></entry>
<entry>Day of the week (<literal>0</literal> on Sunday)</entry>
</row>
<row>
<entry><literal>W</literal></entry>
<entry>ISO-8601 week number of year, weeks starting on
Monday</entry>
</row>
<row>
<entry><literal>y</literal></entry>
<entry>Year (1 or 2 digits - check note below)</entry>
</row>
<row>
<entry><literal>Y</literal></entry>
<entry>Year (4 digits)</entry>
</row>
<row>
<entry><literal>z</literal></entry>
<entry>Day of the year</entry>
</row>
<row>
<entry><literal>Z</literal></entry>
<entry>Timezone offset in seconds</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<note>
<para>
As <function>idate</function> returns always an <type>integer</type> and
as they can't start with a "0", <function>idate</function> may return less
digits then you would expect. See the example below:
</para>
</note>
<para>
<informalexample>
<programlisting role="php">
<!-- $Revision: 1.5 $ -->
<refentry id="function.idate">
<refnamediv>
<refname>idate</refname>
<refpurpose>Format a local time/date as integer</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>idate</methodname>
<methodparam><type>string</type><parameter>format</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>timestamp</parameter></methodparam>
</methodsynopsis>
<para>
Returns a number formatted according to the given format string using the
given integer <parameter>timestamp</parameter> or the current local time
if no timestamp is given. In other words, <parameter>timestamp</parameter>
is optional and defaults to the value of <function>time</function>.
</para>
<para>
Unlike the function <function>date</function>, <function>idate</function>
accepts just one char in the <parameter>format</parameter> parameter.
</para>
<para>
<table>
<title>The following characters are recognized in the
<parameter>format</parameter> parameter string</title>
<tgroup cols="2">
<thead>
<row>
<entry><parameter>format</parameter> character</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><literal>B</literal></entry>
<entry>Swatch Beat/Internet Time</entry>
</row>
<row>
<entry><literal>d</literal></entry>
<entry>Day of the month</entry>
</row>
<row>
<entry><literal>h</literal></entry>
<entry>Hour (12 hour format)</entry>
</row>
<row>
<entry><literal>H</literal></entry>
<entry>Hour (24 hour format)</entry>
</row>
<row>
<entry><literal>i</literal></entry>
<entry>Minutes</entry>
</row>
<row>
<entry><literal>I</literal></entry>
<entry>returns <literal>1</literal> if DST is activated,
<literal>0</literal> otherwise</entry>
</row>
<row>
<entry><literal>L</literal></entry>
<entry>returns <literal>1</literal> for leap year,
<literal>0</literal> otherwise</entry>
</row>
<row>
<entry><literal>m</literal></entry>
<entry>Month number</entry>
</row>
<row>
<entry><literal>s</literal></entry>
<entry>Seconds</entry>
</row>
<row>
<entry><literal>t</literal></entry>
<entry>Days in current month</entry>
</row>
<row>
<entry><literal>U</literal></entry>
<entry>Seconds since the Unix Epoch - January 1 1970 00:00:00 GMT -
this is the same as <function>time</function></entry>
</row>
<row>
<entry><literal>w</literal></entry>
<entry>Day of the week (<literal>0</literal> on Sunday)</entry>
</row>
<row>
<entry><literal>W</literal></entry>
<entry>ISO-8601 week number of year, weeks starting on
Monday</entry>
</row>
<row>
<entry><literal>y</literal></entry>
<entry>Year (1 or 2 digits - check note below)</entry>
</row>
<row>
<entry><literal>Y</literal></entry>
<entry>Year (4 digits)</entry>
</row>
<row>
<entry><literal>z</literal></entry>
<entry>Day of the year</entry>
</row>
<row>
<entry><literal>Z</literal></entry>
<entry>Timezone offset in seconds</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<note>
<para>
As <function>idate</function> returns always an <type>integer</type> and
as they can't start with a "0", <function>idate</function> may return less
digits then you would expect. See the example below:
</para>
</note>
<para>
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
$timestamp = strtotime('1st January 2004'); //1072915200
@ -132,15 +130,15 @@ $timestamp = strtotime('1st January 2004'); //1072915200
echo idate('y', $timestamp);
?>
]]>
</programlisting>
</informalexample>
</para>
<para>
See also <function>date</function> and
<function>time</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</informalexample>
</para>
<para>
See also <function>date</function> and
<function>time</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,93 +1,89 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.4 $ -->
<!-- $Revision: 1.5 $ -->
<!-- splitted from ./en/functions/datetime.xml, last change in rev 1.10 -->
<refentry id="function.localtime">
<refnamediv>
<refname>localtime</refname>
<refpurpose>Get the local time</refpurpose>
</refnamediv>
<refsect1>
<title>Description</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>
The <function>localtime</function> function returns an array
identical to that of the structure returned by the C function
call. The first argument to <function>localtime</function> is
the timestamp, if this is not given the current time as returned
from <function>time</function> is used.
The second argument to the <function>localtime</function> is the
<parameter>is_associative</parameter>, if this is set to 0 or not
supplied than the array is returned as a regular, numerically
indexed array. If the argument is set to 1 then
<function>localtime</function> is an associative array containing
all the different elements of the structure returned by the C
function call to localtime. The names of the different keys of
the associative array are as follows:
<itemizedlist>
<listitem>
<simpara>
"tm_sec" - seconds
</simpara>
</listitem>
<listitem>
<simpara>
"tm_min" - minutes
</simpara>
</listitem>
<listitem>
<simpara>
"tm_hour" - hour
</simpara>
</listitem>
<listitem>
<simpara>
"tm_mday" - day of the month
</simpara>
</listitem>
<listitem>
<simpara>
"tm_mon" - month of the year, starting with 0 for January
</simpara>
</listitem>
<listitem>
<simpara>
"tm_year" - Years since 1900
</simpara>
</listitem>
<listitem>
<simpara>
"tm_wday" - Day of the week
</simpara>
</listitem>
<listitem>
<simpara>
"tm_yday" - Day of the year
</simpara>
</listitem>
<listitem>
<simpara>
"tm_isdst" - Is daylight savings time in effect
</simpara>
</listitem>
</itemizedlist>
</para>
<note>
<refentry id="function.localtime">
<refnamediv>
<refname>localtime</refname>
<refpurpose>Get the local time</refpurpose>
</refnamediv>
<refsect1>
<title>Description</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>
The <function>localtime</function> function returns an array
identical to that of the structure returned by the C function
call. The first argument to <function>localtime</function> is
the timestamp, if this is not given the current time as returned
from <function>time</function> is used.
The second argument to the <function>localtime</function> is the
<parameter>is_associative</parameter>, if this is set to 0 or not
supplied than the array is returned as a regular, numerically
indexed array. If the argument is set to 1 then
<function>localtime</function> is an associative array containing
all the different elements of the structure returned by the C
function call to localtime. The names of the different keys of
the associative array are as follows:
<itemizedlist>
<listitem>
<simpara>
Months are from 0 (Jan) to 11 (Dec) and days of the week are from 0 (Sun) to 6 (Sat).
"tm_sec" - seconds
</simpara>
</note>
<para>
<example>
<title><function>time</function> example</title>
<programlisting role="php">
</listitem>
<listitem>
<simpara>
"tm_min" - minutes
</simpara>
</listitem>
<listitem>
<simpara>
"tm_hour" - hour
</simpara>
</listitem>
<listitem>
<simpara>
"tm_mday" - day of the month
</simpara>
</listitem>
<listitem>
<simpara>
"tm_mon" - month of the year, starting with 0 for January
</simpara>
</listitem>
<listitem>
<simpara>
"tm_year" - Years since 1900
</simpara>
</listitem>
<listitem>
<simpara>
"tm_wday" - Day of the week
</simpara>
</listitem>
<listitem>
<simpara>
"tm_yday" - Day of the year
</simpara>
</listitem>
<listitem>
<simpara>
"tm_isdst" - Is daylight savings time in effect
</simpara>
</listitem>
</itemizedlist>
</para>
<note>
<simpara>
Months are from 0 (Jan) to 11 (Dec) and days of the week are from 0 (Sun) to 6 (Sat).
</simpara>
</note>
<para>
<example>
<title><function>time</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$localtime = localtime();
@ -96,9 +92,9 @@ print_r($localtime);
print_r($localtime_assoc);
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
Array
(
@ -126,11 +122,11 @@ Array
[tm_isdst] => 1
)
]]>
</screen>
</example>
</para>
</refsect1>
</refentry>
</screen>
</example>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,55 +1,53 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.12 $ -->
<!-- $Revision: 1.13 $ -->
<!-- splitted from ./en/functions/datetime.xml, last change in rev 1.2 -->
<refentry id="function.microtime">
<refnamediv>
<refname>microtime</refname>
<refpurpose>
Return current Unix timestamp with microseconds
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</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> returns the current Unix timestamp with
microseconds. This function is only available on operating systems that
support the gettimeofday() system call.
</para>
<para>
When called without the optional argument, this function returns the string
"msec sec" where sec is the current time measured in the number of
seconds since the Unix Epoch (0:00:00 January 1, 1970 GMT), and
msec is the microseconds part.
Both portions of the string are returned in units of seconds.
</para>
<para>
When <parameter>get_as_float</parameter> is given, and evaluates to
&true;, <function>microtime</function> will return a float.
</para>
<note>
<simpara>
The <parameter>get_as_float</parameter> parameter was added as of
PHP 5.0.0.
</simpara>
</note>
<para>
<example>
<title>Timing script execution with <function>microtime</function></title>
<programlisting role="php">
<refentry id="function.microtime">
<refnamediv>
<refname>microtime</refname>
<refpurpose>Return current Unix timestamp with microseconds</refpurpose>
</refnamediv>
<refsect1>
<title>Description</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> returns the current Unix timestamp with
microseconds. This function is only available on operating systems that
support the gettimeofday() system call.
</para>
<para>
When called without the optional argument, this function returns the string
"msec sec" where sec is the current time measured in the number of
seconds since the Unix Epoch (0:00:00 January 1, 1970 GMT), and
msec is the microseconds part.
Both portions of the string are returned in units of seconds.
</para>
<para>
When <parameter>get_as_float</parameter> is given, and evaluates to
&true;, <function>microtime</function> will return a float.
</para>
<note>
<simpara>
The <parameter>get_as_float</parameter> parameter was added as of
PHP 5.0.0.
</simpara>
</note>
<para>
<example>
<title>Timing script execution with <function>microtime</function></title>
<programlisting role="php">
<![CDATA[
<?php
/**
* Simple function to replicate PHP 5 behaviour
*/
function microtime_float()
{
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}
function microtime_float()
{
list($usec, $sec) = explode(" ", microtime());
return ((float)$usec + (float)$sec);
}
$time_start = microtime_float();
@ -62,11 +60,11 @@ $time = $time_end - $time_start;
echo "Did nothing in $time seconds\n";
?>
]]>
</programlisting>
</example>
<example>
<title>Timing script execution in PHP 5</title>
<programlisting role="php">
</programlisting>
</example>
<example>
<title>Timing script execution in PHP 5</title>
<programlisting role="php">
<![CDATA[
<?php
$time_start = microtime(true);
@ -80,14 +78,14 @@ $time = $time_end - $time_start;
echo "Did nothing in $time seconds\n";
?>
]]>
</programlisting>
</example>
</para>
<para>
See also <function>time</function>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<para>
See also <function>time</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,69 +1,69 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.15 $ -->
<!-- $Revision: 1.16 $ -->
<!-- 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>
<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>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
specified.
</para>
<para>
Arguments may be left out in order from right to left; any
arguments thus omitted will be set to the current value according
to the local date and time.
</para>
<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.
</para>
<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.
</para>
<note>
<para>
<parameter>is_dst</parameter> was added in 3.0.10.
</para>
</note>
<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>
<programlisting role="php">
<refentry id="function.mktime">
<refnamediv>
<refname>mktime</refname>
<refpurpose>Get Unix timestamp for a date</refpurpose>
</refnamediv>
<refsect1>
<title>Description</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>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
specified.
</para>
<para>
Arguments may be left out in order from right to left; any
arguments thus omitted will be set to the current value according
to the local date and time.
</para>
<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.
</para>
<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.
</para>
<note>
<para>
<parameter>is_dst</parameter> was added in 3.0.10.
</para>
</note>
<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>
<programlisting role="php">
<![CDATA[
<?php
echo date("M-d-Y", mktime(0, 0, 0, 12, 32, 1997));
@ -72,54 +72,54 @@ 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> 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".
<example>
<title>Last day of next month</title>
<programlisting role="php">
</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".
<example>
<title>Last day of next month</title>
<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);
?>
]]>
</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>
<para>
See also <function>gmmktime</function>,
<function>date</function> and <function>time</function>.
</para>
</refsect1>
</refentry>
</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>
<para>
See also <function>gmmktime</function>,
<function>date</function> and <function>time</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,255 +1,251 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.15 $ -->
<!-- $Revision: 1.16 $ -->
<!-- splitted from ./en/functions/datetime.xml, last change in rev 1.2 -->
<refentry id="function.strftime">
<refnamediv>
<refname>strftime</refname>
<refpurpose>
Format a local time/date according to locale settings
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</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>
<refentry id="function.strftime">
<refnamediv>
<refname>strftime</refname>
<refpurpose>Format a local time/date according to locale settings</refpurpose>
</refnamediv>
<refsect1>
<title>Description</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>
Returns a string formatted according to the given format string
using the given <parameter>timestamp</parameter> or the current
local time if no timestamp is given. Month and weekday names and
other language dependent strings respect the current locale set
with <function>setlocale</function>.
</para>
<para>
The following conversion specifiers are recognized in the format
string:
<itemizedlist>
<listitem>
<simpara>
%a - abbreviated weekday name according to the current locale
</simpara>
</listitem>
<listitem>
<simpara>
%A - full weekday name according to the current locale
</simpara>
</listitem>
<listitem>
<simpara>
%b - abbreviated month name according to the current locale
</simpara>
</listitem>
<listitem>
<simpara>
%B - full month name according to the current locale
</simpara>
</listitem>
<listitem>
<simpara>
%c - preferred date and time representation for the current
locale
</simpara>
</listitem>
<listitem>
<simpara>
%C - century number (the year divided by 100 and truncated to
an integer, range 00 to 99)
</simpara>
</listitem>
<listitem>
<simpara>
%d - day of the month as a decimal number (range 01 to 31)
</simpara>
</listitem>
<listitem>
<simpara>
%D - same as %m/%d/%y
</simpara>
</listitem>
<listitem>
<simpara>
%e - day of the month as a decimal number, a single digit is
preceded by a space (range ' 1' to '31')
</simpara>
</listitem>
<listitem>
<simpara>
%g - like %G, but without the century.
</simpara>
</listitem>
<listitem>
<simpara>
%G - The 4-digit year corresponding to the ISO week number (see %V).
This has the same format and value as %Y, except that if the ISO week
number belongs to the previous or next year, that year is used
instead.
</simpara>
</listitem>
<listitem>
<simpara>
%h - same as %b
</simpara>
</listitem>
<listitem>
<simpara>
%H - hour as a decimal number using a 24-hour clock (range 00
to 23)
</simpara>
</listitem>
<listitem>
<simpara>
%I - hour as a decimal number using a 12-hour clock (range 01
to 12)
</simpara>
</listitem>
<listitem>
<simpara>
%j - day of the year as a decimal number (range 001 to 366)
</simpara>
</listitem>
<listitem>
<simpara>
%m - month as a decimal number (range 01 to 12)
</simpara>
</listitem>
<listitem>
<simpara>
%M - minute as a decimal number
</simpara>
</listitem>
<listitem>
<simpara>
%n - newline character
</simpara>
</listitem>
<listitem>
<simpara>
%p - either `am' or `pm' according to the given time value, or
the corresponding strings for the current locale
</simpara>
</listitem>
<listitem>
<simpara>
%r - time in a.m. and p.m. notation
</simpara>
</listitem>
<listitem>
<simpara>
%R - time in 24 hour notation
</simpara>
</listitem>
<listitem>
<simpara>
%S - second as a decimal number
</simpara>
</listitem>
<listitem>
<simpara>
%t - tab character
</simpara>
</listitem>
<listitem>
<simpara>
%T - current time, equal to %H:%M:%S
</simpara>
</listitem>
<listitem>
<simpara>
%u - weekday as a decimal number [1,7], with 1 representing
Monday
</simpara>
<warning>
<simpara>
Sun Solaris seems to start with Sunday as 1
although ISO 9889:1999 (the current C standard) clearly
specifies that it should be Monday.
</simpara>
</warning>
</listitem>
<listitem>
<simpara>
%U - week number of the current year as a decimal number,
starting with the first Sunday as the first day of the first
week
</simpara>
</listitem>
<listitem>
<simpara>
%V - The ISO 8601:1988 week number of the current year as a
decimal number, range 01 to 53, where week 1 is the first
week that has at least 4 days in the current year, and with
Monday as the first day of the week. (Use %G or %g for the year
component that corresponds to the week number for the specified
timestamp.)
</simpara>
</listitem>
<listitem>
<simpara>
%W - week number of the current year as a decimal number,
starting with the first Monday as the first day of the first
week
</simpara>
</listitem>
<listitem>
<simpara>
%w - day of the week as a decimal, Sunday being 0
</simpara>
</listitem>
<listitem>
<simpara>
%x - preferred date representation for the current locale
without the time
</simpara>
</listitem>
<listitem>
<simpara>
%X - preferred time representation for the current locale
without the date
</simpara>
</listitem>
<listitem>
<simpara>
%y - year as a decimal number without a century (range 00 to
99)
</simpara>
</listitem>
<listitem>
<simpara>
%Y - year as a decimal number including the century
</simpara>
</listitem>
<listitem>
<simpara>
%Z or %z - time zone or name or abbreviation
</simpara>
</listitem>
<listitem>
<simpara>
%% - a literal `%' character
</simpara>
</listitem>
</itemizedlist>
<note>
<para>
Returns a string formatted according to the given format string
using the given <parameter>timestamp</parameter> or the current
local time if no timestamp is given. Month and weekday names and
other language dependent strings respect the current locale set
with <function>setlocale</function>.
Not all conversion specifiers may be supported by your C
library, in which case they will not be supported by PHP's
<function>strftime</function>. Additionally, not all platforms
support negative timestamps, therefore your date range may
be limited to no earlier than the Unix epoch. This means that
e.g. %e, %T, %R and %D (there might be more) and dates prior to
<literal>Jan 1, 1970</literal> will not work on Windows, some Linux
distributions, and a few other operating systems. For Windows systems a
complete overview of supported conversion specifiers can be found at this
<ulink url="&url.strftime.win32;"><acronym>MSDN</acronym> website</ulink>.
</para>
<para>
The following conversion specifiers are recognized in the format
string:
<itemizedlist>
<listitem>
<simpara>
%a - abbreviated weekday name according to the current locale
</simpara>
</listitem>
<listitem>
<simpara>
%A - full weekday name according to the current locale
</simpara>
</listitem>
<listitem>
<simpara>
%b - abbreviated month name according to the current locale
</simpara>
</listitem>
<listitem>
<simpara>
%B - full month name according to the current locale
</simpara>
</listitem>
<listitem>
<simpara>
%c - preferred date and time representation for the current
locale
</simpara>
</listitem>
<listitem>
<simpara>
%C - century number (the year divided by 100 and truncated to
an integer, range 00 to 99)
</simpara>
</listitem>
<listitem>
<simpara>
%d - day of the month as a decimal number (range 01 to 31)
</simpara>
</listitem>
<listitem>
<simpara>
%D - same as %m/%d/%y
</simpara>
</listitem>
<listitem>
<simpara>
%e - day of the month as a decimal number, a single digit is
preceded by a space (range ' 1' to '31')
</simpara>
</listitem>
<listitem>
<simpara>
%g - like %G, but without the century.
</simpara>
</listitem>
<listitem>
<simpara>
%G - The 4-digit year corresponding to the ISO week number (see %V).
This has the same format and value as %Y, except that if the ISO week
number belongs to the previous or next year, that year is used
instead.
</simpara>
</listitem>
<listitem>
<simpara>
%h - same as %b
</simpara>
</listitem>
<listitem>
<simpara>
%H - hour as a decimal number using a 24-hour clock (range 00
to 23)
</simpara>
</listitem>
<listitem>
<simpara>
%I - hour as a decimal number using a 12-hour clock (range 01
to 12)
</simpara>
</listitem>
<listitem>
<simpara>
%j - day of the year as a decimal number (range 001 to 366)
</simpara>
</listitem>
<listitem>
<simpara>
%m - month as a decimal number (range 01 to 12)
</simpara>
</listitem>
<listitem>
<simpara>
%M - minute as a decimal number
</simpara>
</listitem>
<listitem>
<simpara>
%n - newline character
</simpara>
</listitem>
<listitem>
<simpara>
%p - either `am' or `pm' according to the given time value, or
the corresponding strings for the current locale
</simpara>
</listitem>
<listitem>
<simpara>
%r - time in a.m. and p.m. notation
</simpara>
</listitem>
<listitem>
<simpara>
%R - time in 24 hour notation
</simpara>
</listitem>
<listitem>
<simpara>
%S - second as a decimal number
</simpara>
</listitem>
<listitem>
<simpara>
%t - tab character
</simpara>
</listitem>
<listitem>
<simpara>
%T - current time, equal to %H:%M:%S
</simpara>
</listitem>
<listitem>
<simpara>
%u - weekday as a decimal number [1,7], with 1 representing
Monday
</simpara>
<warning>
<simpara>
Sun Solaris seems to start with Sunday as 1
although ISO 9889:1999 (the current C standard) clearly
specifies that it should be Monday.
</simpara>
</warning>
</listitem>
<listitem>
<simpara>
%U - week number of the current year as a decimal number,
starting with the first Sunday as the first day of the first
week
</simpara>
</listitem>
<listitem>
<simpara>
%V - The ISO 8601:1988 week number of the current year as a
decimal number, range 01 to 53, where week 1 is the first
week that has at least 4 days in the current year, and with
Monday as the first day of the week. (Use %G or %g for the year
component that corresponds to the week number for the specified
timestamp.)
</simpara>
</listitem>
<listitem>
<simpara>
%W - week number of the current year as a decimal number,
starting with the first Monday as the first day of the first
week
</simpara>
</listitem>
<listitem>
<simpara>
%w - day of the week as a decimal, Sunday being 0
</simpara>
</listitem>
<listitem>
<simpara>
%x - preferred date representation for the current locale
without the time
</simpara>
</listitem>
<listitem>
<simpara>
%X - preferred time representation for the current locale
without the date
</simpara>
</listitem>
<listitem>
<simpara>
%y - year as a decimal number without a century (range 00 to
99)
</simpara>
</listitem>
<listitem>
<simpara>
%Y - year as a decimal number including the century
</simpara>
</listitem>
<listitem>
<simpara>
%Z or %z - time zone or name or abbreviation
</simpara>
</listitem>
<listitem>
<simpara>
%% - a literal `%' character
</simpara>
</listitem>
</itemizedlist>
<note>
<para>
Not all conversion specifiers may be supported by your C
library, in which case they will not be supported by PHP's
<function>strftime</function>. Additionally, not all platforms
support negative timestamps, therefore your date range may
be limited to no earlier than the Unix epoch. This means that
e.g. %e, %T, %R and %D (there might be more) and dates prior to
<literal>Jan 1, 1970</literal> will not work on Windows, some Linux
distributions, and a few other operating systems. For Windows systems a
complete overview of supported conversion specifiers can be found at this
<ulink url="&url.strftime.win32;"><acronym>MSDN</acronym> website</ulink>.
</para>
</note>
<example>
<title><function>strftime</function> locale examples</title>
<programlisting role="php">
</note>
<example>
<title><function>strftime</function> locale examples</title>
<programlisting role="php">
<![CDATA[
<?php
setlocale(LC_TIME, "C");
@ -262,26 +258,26 @@ setlocale(LC_TIME, "de_DE");
echo strftime(" in German %A.\n");
?>
]]>
</programlisting>
</example>
This example works if you have the respective locales installed
in your system.
<note>
<simpara>
%G and %V, which are based on ISO 8601:1988 week numbers can
give unexpected (albeit correct) results if the numbering system
is not thoroughly understood. See %V above and example below.
</simpara>
</note>
<example>
<title>ISO 8601:1988 week number example</title>
<programlisting role="php">
</programlisting>
</example>
This example works if you have the respective locales installed
in your system.
<note>
<simpara>
%G and %V, which are based on ISO 8601:1988 week numbers can
give unexpected (albeit correct) results if the numbering system
is not thoroughly understood. See %V above and example below.
</simpara>
</note>
<example>
<title>ISO 8601:1988 week number example</title>
<programlisting role="php">
<![CDATA[
<?php
/* December 2002 / January 2003
ISOWk M Tu W Thu F Sa Su
----- ----------------------------
51 16 17 18 19 20 21 22
51 16 17 18 19 20 21 22
52 23 24 25 26 27 28 29
1 30 31 1 2 3 4 5
2 6 7 8 9 10 11 12
@ -324,18 +320,18 @@ echo "1/3/2005 - %V,%G,%Y = " . strftime("%V,%G,%Y",strtotime("1/3/2005")) . "\n
?>
]]>
</programlisting>
</example>
</para>
<para>
See also <function>setlocale</function>,
<function>mktime</function>,
<function>strptime</function>,
and the <ulink url="&spec.strftime;">
Open Group specification of <function>strftime</function></ulink>.
</para>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<para>
See also <function>setlocale</function>,
<function>mktime</function>,
<function>strptime</function>,
and the <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:

View file

@ -1,46 +1,43 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.11 $ -->
<!-- $Revision: 1.12 $ -->
<!-- splitted from ./en/functions/datetime.xml, last change in rev 1.8 -->
<refentry id="function.strtotime">
<refnamediv>
<refname>strtotime</refname>
<refpurpose>
Parse about any English textual datetime description into a Unix
timestamp
</refpurpose>
</refnamediv>
<refsect1>
<title>Description</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>
The function expects to be given a string containing an English date
format and will try to parse that format into a Unix timestamp (the
number of seconds since January 1 1970 00:00:00 GMT), relative
to the timestamp given in <parameter>now</parameter>, or the current time
if none is supplied. Upon failure, <literal>-1</literal> is returned.
</simpara>
<simpara>
Because <function>strtotime</function> behaves according to GNU
date syntax, have a look at the GNU manual page titled
<ulink url="&url.gnu.man.date-input;">Date Input Formats</ulink>.
Described there is valid syntax for the <parameter>time</parameter>
parameter.
</simpara>
<warning>
<para>
In PHP 5 up to 5.0.2, <literal>"now"</literal> and other relative times
are wrongly computed from today's midnight. It differs from other
versions where it is correctly computed from current time.
</para>
</warning>
<para>
<example>
<title><function>strtotime</function> examples</title>
<programlisting role="php">
<refentry id="function.strtotime">
<refnamediv>
<refname>strtotime</refname>
<refpurpose>Parse about any English textual datetime description into a Unix timestamp</refpurpose>
</refnamediv>
<refsect1>
<title>Description</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>
The function expects to be given a string containing an English date
format and will try to parse that format into a Unix timestamp (the
number of seconds since January 1 1970 00:00:00 GMT), relative
to the timestamp given in <parameter>now</parameter>, or the current time
if none is supplied. Upon failure, <literal>-1</literal> is returned.
</simpara>
<simpara>
Because <function>strtotime</function> behaves according to GNU
date syntax, have a look at the GNU manual page titled
<ulink url="&url.gnu.man.date-input;">Date Input Formats</ulink>.
Described there is valid syntax for the <parameter>time</parameter>
parameter.
</simpara>
<warning>
<para>
In PHP 5 up to 5.0.2, <literal>"now"</literal> and other relative times
are wrongly computed from today's midnight. It differs from other
versions where it is correctly computed from current time.
</para>
</warning>
<para>
<example>
<title><function>strtotime</function> examples</title>
<programlisting role="php">
<![CDATA[
<?php
echo strtotime("now"), "\n";
@ -52,13 +49,13 @@ echo strtotime("next Thursday"), "\n";
echo strtotime("last Monday"), "\n";
?>
]]>
</programlisting>
</example>
</para>
<para>
<example>
<title>Checking for failure</title>
<programlisting role="php">
</programlisting>
</example>
</para>
<para>
<example>
<title>Checking for failure</title>
<programlisting role="php">
<![CDATA[
<?php
$str = 'Not Good';
@ -69,23 +66,23 @@ if (($timestamp = strtotime($str)) === -1) {
}
?>
]]>
</programlisting>
</example>
</para>
<note>
<para>
The valid range of a timestamp is typically from Fri, 13 Dec
1901 20:45:54 GMT to Tue, 19 Jan 2038 03:14:07 GMT. (These are
the dates that correspond to the minimum and maximum values for
a 32-bit signed integer.)
Additionally, not all platforms support negative timestamps, therefore
your date range may be limited to no earlier than the Unix epoch. This
means that e.g. dates prior to Jan 1, 1970 will not work on Windows,
some Linux distributions, and a few other operating systems.
</para>
</note>
</refsect1>
</refentry>
</programlisting>
</example>
</para>
<note>
<para>
The valid range of a timestamp is typically from Fri, 13 Dec
1901 20:45:54 GMT to Tue, 19 Jan 2038 03:14:07 GMT. (These are
the dates that correspond to the minimum and maximum values for
a 32-bit signed integer.)
Additionally, not all platforms support negative timestamps, therefore
your date range may be limited to no earlier than the Unix epoch. This
means that e.g. dates prior to Jan 1, 1970 will not work on Windows,
some Linux distributions, and a few other operating systems.
</para>
</note>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:

View file

@ -1,25 +1,25 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.5 $ -->
<!-- $Revision: 1.6 $ -->
<!-- splitted from ./en/functions/datetime.xml, last change in rev 1.2 -->
<refentry id="function.time">
<refnamediv>
<refname>time</refname>
<refpurpose>Return current Unix timestamp</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>time</methodname>
<void/>
</methodsynopsis>
<para>
Returns the current time measured in the number of seconds since
the Unix Epoch (January 1 1970 00:00:00 GMT).
</para>
<para>
<example>
<title><function>time</function> example</title>
<programlisting role="php">
<refentry id="function.time">
<refnamediv>
<refname>time</refname>
<refpurpose>Return current Unix timestamp</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<methodsynopsis>
<type>int</type><methodname>time</methodname>
<void/>
</methodsynopsis>
<para>
Returns the current time measured in the number of seconds since
the Unix Epoch (January 1 1970 00:00:00 GMT).
</para>
<para>
<example>
<title><function>time</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
$nextWeek = time() + (7 * 24 * 60 * 60);
@ -28,21 +28,21 @@ echo 'Now: '. date('Y-m-d') ."\n";
echo 'Next Week: '. date('Y-m-d', $nextWeek) ."\n";
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
Now: 2005-03-30
Next Week: 2005-04-07
]]>
</screen>
</example>
</para>
<para>
See also <function>date</function> and <function>microtime</function>.
</para>
</refsect1>
</refentry>
</screen>
</example>
</para>
<para>
See also <function>date</function> and <function>microtime</function>.
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables: