cvs: phpdoc /en language-snippets.ent /en/reference/datetime/functions date-add.xml date-create.xml date-date-set.xml date-default-timezone-get.xml
date-default-timezone-set.xml date-format.xml date-isodate-set.xml date-modify.xml date-offset-get.xml date-sub.xml date-time-set.xml
date-timezone-get.xml date-timezone-set.xml timezone-name-get.xml timezone-offset-get.xml timezone-transitions-get.xml

From: Date: Sun, 02 Nov 2008 22:11:33 +0000
Subject: cvs: phpdoc /en language-snippets.ent /en/reference/datetime/functions date-add.xml date-create.xml date-date-set.xml date-default-timezone-get.xml
date-default-timezone-set.xml date-format.xml date-isodate-set.xml date-modify.xml date-offset-get.xml date-sub.xml date-time-set.xml
date-timezone-get.xml date-timezone-set.xml timezone-name-get.xml timezone-offset-get.xml timezone-transitions-get.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-2363@lists.php.net to get a copy of this message
ross Sun Nov 2 22:11:33 2008 UTC Modified files: /phpdoc/en language-snippets.ent /phpdoc/en/reference/datetime/functions date-add.xml date-create.xml date-date-set.xml date-default-timezone-get.xml date-default-timezone-set.xml date-format.xml date-isodate-set.xml date-modify.xml date-offset-get.xml date-sub.xml date-time-set.xml date-timezone-get.xml date-timezone-set.xml timezone-name-get.xml timezone-offset-get.xml timezone-transitions-get.xml Log: Added entities for procedural-only object parameters for DateTime and DateTimeZone. &date.datetime.description: date_* (except date_default_timezone_*, date_create) &date.datetimezone.description: timezone_* Added examples for: reference\datetime\functions date-create.xml date-date-set.xml date-default-timezone-get.xml date-default-timezone-set.xml date-format.xml date-isodate-set.xml date-offset-get.xml date-time-set.xml date-timezone-get.xml date-timezone-set.xml Added descriptions for: reference\datetime\functions date-create.xml date-date-set.xml date-isodate-set.xml date-modify.xml date-time-set.xml

http://cvs.php.net/viewvc.cgi/phpdoc/en/language-snippets.ent?r1=1.232&r2=1.233&diff_format=u Index: phpdoc/en/language-snippets.ent diff -u phpdoc/en/language-snippets.ent:1.232 phpdoc/en/language-snippets.ent:1.233 --- phpdoc/en/language-snippets.ent:1.232 Fri Oct 24 23:11:12 2008 +++ phpdoc/en/language-snippets.ent Sun Nov 2 22:11:33 2008 @@ -1,4 +1,4 @@ -<!-- $Revision: 1.232 $ --> +<!-- $Revision: 1.233 $ --> <!-- Keep 'em sorted --> @@ -347,6 +347,14 @@ words, it defaults to the value of <function>time</function>. </para></listitem></varlistentry>'> +<!ENTITY date.datetime.description '<varlistentry><term><parameter> +object</parameter></term><listitem><para>Procedural style only: A <classname>DateTime</classname> object +returned by <function>date_create</function></para></listitem></varlistentry>'> + +<!ENTITY date.datetimezone.description '<varlistentry><term><parameter> +object</parameter></term><listitem><para>Procedural style only: A <classname>DateTimeZone</classname> object +returned by <function>timezone_open</function></para></listitem></varlistentry>'> + <!-- DomXml Notes --> <!ENTITY node.inserted 'This node will not show up in the document unless it is inserted with (e.g.) <function>domnode_append_child</function>.'> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/datetime/functions/date-add.xml?r1=1.7&r2=1.8&diff_format=u Index: phpdoc/en/reference/datetime/functions/date-add.xml diff -u phpdoc/en/reference/datetime/functions/date-add.xml:1.7 phpdoc/en/reference/datetime/functions/date-add.xml:1.8 --- phpdoc/en/reference/datetime/functions/date-add.xml:1.7 Wed Oct 29 13:33:22 2008 +++ phpdoc/en/reference/datetime/functions/date-add.xml Sun Nov 2 22:11:33 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.7 $ --> +<!-- $Revision: 1.8 $ --> <refentry xml:id="function.date-add" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>date_add</refname> @@ -26,16 +26,7 @@ &reftitle.parameters; <para> <variablelist> - <varlistentry> - <term> - <parameter>object</parameter> - </term> - <listitem> - <para> - A date as returned by <classname>DateTime</classname>. - </para> - </listitem> - </varlistentry> + &date.datetime.description; <varlistentry> <term> <parameter>interval</parameter> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/datetime/functions/date-create.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/datetime/functions/date-create.xml diff -u phpdoc/en/reference/datetime/functions/date-create.xml:1.2 phpdoc/en/reference/datetime/functions/date-create.xml:1.3 --- phpdoc/en/reference/datetime/functions/date-create.xml:1.2 Wed Jun 20 22:24:18 2007 +++ phpdoc/en/reference/datetime/functions/date-create.xml Sun Nov 2 22:11:33 2008 @@ -1,10 +1,11 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xml:id="function.date-create" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>date_create</refname> <refpurpose>Returns new DateTime object</refpurpose> </refnamediv> + <refsect1 role="description"> &reftitle.description; <methodsynopsis> @@ -51,6 +52,46 @@ </para> </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title>Object oriented style</title> + <programlisting role="php"> +<![CDATA[ +<?php +date_default_timezone_set('Europe/London'); + +$datetime = new DateTime('2008-08-03 14:52:10'); +echo $datetime->format(DATE_ATOM); +?> +]]> + </programlisting> + </example> + </para> + <para> + <example> + <title>Procedural style</title> + <programlisting role="php"> +<![CDATA[ +<?php +date_default_timezone_set('Europe/London'); + +$datetime = date_create('2008-08-03 14:52:10'); +echo date_format($datetime, DATE_ATOM); +?> +]]> + </programlisting> + &example.outputs; + <screen> +<![CDATA[ +2008-08-03T14:52:10+01:00 +]]> + </screen> + </example> + </para> + </refsect1> + </refentry> <!-- Keep this comment at the end of the file http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/datetime/functions/date-date-set.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/datetime/functions/date-date-set.xml diff -u phpdoc/en/reference/datetime/functions/date-date-set.xml:1.2 phpdoc/en/reference/datetime/functions/date-date-set.xml:1.3 --- phpdoc/en/reference/datetime/functions/date-date-set.xml:1.2 Wed Jun 20 22:24:18 2007 +++ phpdoc/en/reference/datetime/functions/date-date-set.xml Sun Nov 2 22:11:33 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xml:id="function.date-date-set" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>date_date_set</refname> @@ -20,20 +20,16 @@ <methodparam><type>int</type><parameter>month</parameter></methodparam> <methodparam><type>int</type><parameter>day</parameter></methodparam> </methodsynopsis> + <para> + Resets the current date of the DateTime object to a different date. + </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> - <varlistentry> - <term><parameter>object</parameter></term> - <listitem> - <para> - DateTime object. - </para> - </listitem> - </varlistentry> + &date.datetime.description; <varlistentry> <term><parameter>year</parameter></term> <listitem> @@ -69,6 +65,50 @@ </para> </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title>Procedural example usage</title> + <programlisting role="php"> +<![CDATA[ +<?php +date_default_timezone_set('Europe/London'); + +$datetime = new DateTime('2008-08-03 14:52:10'); +$datetime->setDate(2008, 10, 12); + +echo $datetime->format(DATE_RFC2822); +?> +]]> + </programlisting> + </example> + </para> + <para> + <example> + <title>Object oriented example usage</title> + <programlisting role="php"> +<![CDATA[ +<?php +date_default_timezone_set('Europe/London'); + +$datetime = date_create('2008-08-03 14:52:10'); +date_date_set($datetime, 2008, 10, 12); + +echo date_format($datetime, DATE_RFC2822); +?> +]]> + </programlisting> + &example.outputs; + <screen> +<![CDATA[ +Sun, 12 Oct 2008 14:52:10 +0100 +]]> + </screen> + </example> + </para> + </refsect1> + <refsect1 role="seealso"> &reftitle.seealso; <para> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/datetime/functions/date-default-timezone-get.xml?r1=1.6&r2=1.7&diff_format=u Index: phpdoc/en/reference/datetime/functions/date-default-timezone-get.xml diff -u phpdoc/en/reference/datetime/functions/date-default-timezone-get.xml:1.6 phpdoc/en/reference/datetime/functions/date-default-timezone-get.xml:1.7 --- phpdoc/en/reference/datetime/functions/date-default-timezone-get.xml:1.6 Fri Jul 18 06:03:44 2008 +++ phpdoc/en/reference/datetime/functions/date-default-timezone-get.xml Sun Nov 2 22:11:33 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.6 $ --> +<!-- $Revision: 1.7 $ --> <refentry xml:id="function.date-default-timezone-get" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>date_default_timezone_get</refname> @@ -53,6 +53,57 @@ </para> </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title>Getting the default timezone</title> + <programlisting role="php"> +<![CDATA[ +<?php +date_default_timezone_set('Europe/London'); + +if (date_default_timezone_get()) { + echo 'date_default_timezone_set: ' . date_default_timezone_get() . '<br />'; +} + +if (ini_get('date.timezone')) { + echo 'date.timezone: ' . ini_get('date.timezone'); +} + +?> +]]> + </programlisting> + &example.outputs.similar; + <screen> +<![CDATA[ +date_default_timezone_set: Europe/London +date.timezone: Europe/London +]]> + </screen> + </example> + </para> + <para> + <example> + <title>Getting the abbreviation of a timezone</title> + <programlisting role="php"> +<![CDATA[ +<?php +date_default_timezone_set('America/Los_Angeles'); +echo date_default_timezone_get() . ' => ' . date('e') . ' => ' . date('T'); +?> +]]> + </programlisting> + &example.outputs; + <screen> +<![CDATA[ +America/Los_Angeles => America/Los_Angeles => PST +]]> + </screen> + </example> + </para> + </refsect1> + <refsect1 role="seealso"> &reftitle.seealso; <para> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/datetime/functions/date-default-timezone-set.xml?r1=1.7&r2=1.8&diff_format=u Index: phpdoc/en/reference/datetime/functions/date-default-timezone-set.xml diff -u phpdoc/en/reference/datetime/functions/date-default-timezone-set.xml:1.7 phpdoc/en/reference/datetime/functions/date-default-timezone-set.xml:1.8 --- phpdoc/en/reference/datetime/functions/date-default-timezone-set.xml:1.7 Wed Jun 20 22:24:18 2007 +++ phpdoc/en/reference/datetime/functions/date-default-timezone-set.xml Sun Nov 2 22:11:33 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.7 $ --> +<!-- $Revision: 1.8 $ --> <refentry xml:id="function.date-default-timezone-set" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>date_default_timezone_set</refname> @@ -61,6 +61,30 @@ </para> </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title>Getting the default timezone</title> + <programlisting role="php"> +<![CDATA[ +<?php +date_default_timezone_set('America/Los_Angeles'); + +$script_tz = date_default_timezone_get(); + +if (strcmp($script_tz, ini_get('date.timezone'))){ + echo 'Script timezone differs from ini-set timezone.'; +} else { + echo 'Script timezone and ini-set timezone match.'; +} +?> +]]> + </programlisting> + </example> + </para> + </refsect1> + <refsect1 role="changelog"> &reftitle.changelog; <para> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/datetime/functions/date-format.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/datetime/functions/date-format.xml diff -u phpdoc/en/reference/datetime/functions/date-format.xml:1.2 phpdoc/en/reference/datetime/functions/date-format.xml:1.3 --- phpdoc/en/reference/datetime/functions/date-format.xml:1.2 Wed Jun 20 22:24:18 2007 +++ phpdoc/en/reference/datetime/functions/date-format.xml Sun Nov 2 22:11:33 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xml:id="function.date-format" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>date_format</refname> @@ -22,14 +22,7 @@ &reftitle.parameters; <para> <variablelist> - <varlistentry> - <term><parameter>object</parameter></term> - <listitem> - <para> - DateTime object. - </para> - </listitem> - </varlistentry> + &date.datetime.description; <varlistentry> <term><parameter>format</parameter></term> <listitem> @@ -49,6 +42,50 @@ </para> </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title>Displaying the date and time using the procedural form</title> + <programlisting role="php"> +<![CDATA[ +<?php +date_default_timezone_set('Europe/London'); + +$datetime = date_create('2008-08-03 14:52:10'); +echo date_format($datetime, 'jS, F Y') . "\n"; +echo date_format($datetime, DATE_ATOM); +?> +]]> + </programlisting> + </example> + </para> + <para> + <example> + <title>Displaying the date and time using the object oriented form</title> + <programlisting role="php"> +<![CDATA[ +<?php +date_default_timezone_set('Europe/London'); + +$datetime = new DateTime('2008-08-03 14:52:10'); +echo $datetime->format('jS, F Y') . "\n"; +echo $datetime->format(DATE_ATOM); +?> +?> +]]> + </programlisting> + &example.outputs; + <screen> +<![CDATA[ +3rd, August 2008 +2008-08-03T14:52:10+01:00 +]]> + </screen> + </example> + </para> + </refsect1> + <refsect1 role="seealso"> &reftitle.seealso; <para> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/datetime/functions/date-isodate-set.xml?r1=1.3&r2=1.4&diff_format=u Index: phpdoc/en/reference/datetime/functions/date-isodate-set.xml diff -u phpdoc/en/reference/datetime/functions/date-isodate-set.xml:1.3 phpdoc/en/reference/datetime/functions/date-isodate-set.xml:1.4 --- phpdoc/en/reference/datetime/functions/date-isodate-set.xml:1.3 Thu Jul 5 12:59:25 2007 +++ phpdoc/en/reference/datetime/functions/date-isodate-set.xml Sun Nov 2 22:11:33 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.3 $ --> +<!-- $Revision: 1.4 $ --> <refentry xml:id="function.date-isodate-set" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>date_isodate_set</refname> @@ -20,20 +20,17 @@ <methodparam><type>int</type><parameter>week</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>day</parameter></methodparam> </methodsynopsis> + <para> + Set a date according to the ISO 8601 standard - using weeks and day offsets + rather than specific dates. + </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> - <varlistentry> - <term><parameter>object</parameter></term> - <listitem> - <para> - DateTime object. - </para> - </listitem> - </varlistentry> + &date.datetime.description; <varlistentry> <term><parameter>year</parameter></term> <listitem> @@ -54,7 +51,7 @@ <term><parameter>day</parameter></term> <listitem> <para> - Day of the date. + Offset from the first day of the week. </para> </listitem> </varlistentry> @@ -69,6 +66,45 @@ </para> </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title>Finding the date from a week number and day offset</title> + <programlisting role="php"> +<![CDATA[ +<?php +date_default_timezone_set('Europe/London'); + +$datetime = new DateTime(); + +// Offset from start of week 2 (7) = 5 +$datetime->setISODate(2008, 2, 5); // Day 5 of week 2 of 2008 is the 11th of January. + +// Offset from start of week 2 (7) = 10 +$datetime->setISODate(2008, 2, 10); // Day 10 of week 2 of 2008 is the 16th of January. +?> +]]> + </programlisting> + </example> + </para> + <para> + <example> + <title>Finding the month a week is in</title> + <programlisting role="php"> +<![CDATA[ +<?php +date_default_timezone_set('Europe/London'); + +$datetime = date_create(); +date_isodate_set($datetime, 2008, 6); // Week 6 of 2008 is in February. +?> +]]> + </programlisting> + </example> + </para> + </refsect1> + <refsect1 role="seealso"> &reftitle.seealso; <para> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/datetime/functions/date-modify.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/datetime/functions/date-modify.xml diff -u phpdoc/en/reference/datetime/functions/date-modify.xml:1.2 phpdoc/en/reference/datetime/functions/date-modify.xml:1.3 --- phpdoc/en/reference/datetime/functions/date-modify.xml:1.2 Wed Jun 20 22:24:18 2007 +++ phpdoc/en/reference/datetime/functions/date-modify.xml Sun Nov 2 22:11:33 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xml:id="function.date-modify" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>date_modify</refname> @@ -16,20 +16,17 @@ <type>void</type><methodname>DateTime::modify</methodname> <methodparam><type>string</type><parameter>modify</parameter></methodparam> </methodsynopsis> + <para> + Alter the timestamp of a DateTime object by incrementing or decrementing in a + format accepted by <function>strtotime</function>. + </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> - <varlistentry> - <term><parameter>object</parameter></term> - <listitem> - <para> - DateTime object. - </para> - </listitem> - </varlistentry> + &date.datetime.description; <varlistentry> <term><parameter>modify</parameter></term> <listitem> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/datetime/functions/date-offset-get.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/datetime/functions/date-offset-get.xml diff -u phpdoc/en/reference/datetime/functions/date-offset-get.xml:1.2 phpdoc/en/reference/datetime/functions/date-offset-get.xml:1.3 --- phpdoc/en/reference/datetime/functions/date-offset-get.xml:1.2 Wed Jun 20 22:24:18 2007 +++ phpdoc/en/reference/datetime/functions/date-offset-get.xml Sun Nov 2 22:11:33 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xml:id="function.date-offset-get" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>date_offset_get</refname> @@ -21,14 +21,7 @@ &reftitle.parameters; <para> <variablelist> - <varlistentry> - <term><parameter>object</parameter></term> - <listitem> - <para> - DateTime object. - </para> - </listitem> - </varlistentry> + &date.datetime.description; </variablelist> </para> </refsect1> @@ -40,6 +33,28 @@ </para> </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title>Comparing offsets between Summer and Winter</title> + <programlisting role="php"> +<![CDATA[ +<?php +date_default_timezone_set('Europe/London'); + +$winter = new DateTime('2008-12-25 14:25:41'); +$summer = new DateTime('2008-07-14 14:25:41'); + +echo $winter->getOffset(); // Winter offset: 0 +echo $summer->getOffset(); // Summer offset: 3600 = 1 hour +?> +]]> + </programlisting> + </example> + </para> + </refsect1> + </refentry> <!-- Keep this comment at the end of the file http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/datetime/functions/date-sub.xml?r1=1.5&r2=1.6&diff_format=u Index: phpdoc/en/reference/datetime/functions/date-sub.xml diff -u phpdoc/en/reference/datetime/functions/date-sub.xml:1.5 phpdoc/en/reference/datetime/functions/date-sub.xml:1.6 --- phpdoc/en/reference/datetime/functions/date-sub.xml:1.5 Tue Jul 29 17:58:29 2008 +++ phpdoc/en/reference/datetime/functions/date-sub.xml Sun Nov 2 22:11:33 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.5 $ --> +<!-- $Revision: 1.6 $ --> <refentry xml:id="function.date-sub" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>date_sub</refname> @@ -26,16 +26,7 @@ &reftitle.parameters; <para> <variablelist> - <varlistentry> - <term> - <parameter>object</parameter> - </term> - <listitem> - <para> - A date as returned by <classname>DateTime</classname>. - </para> - </listitem> - </varlistentry> + &date.datetime.description; <varlistentry> <term> <parameter>interval</parameter> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/datetime/functions/date-time-set.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/datetime/functions/date-time-set.xml diff -u phpdoc/en/reference/datetime/functions/date-time-set.xml:1.2 phpdoc/en/reference/datetime/functions/date-time-set.xml:1.3 --- phpdoc/en/reference/datetime/functions/date-time-set.xml:1.2 Wed Jun 20 22:24:18 2007 +++ phpdoc/en/reference/datetime/functions/date-time-set.xml Sun Nov 2 22:11:33 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xml:id="function.date-time-set" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>date_time_set</refname> @@ -20,20 +20,16 @@ <methodparam><type>int</type><parameter>minute</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>second</parameter></methodparam> </methodsynopsis> + <para> + Resets the current time of the DateTime object to a different time. + </para> </refsect1> <refsect1 role="parameters"> &reftitle.parameters; <para> <variablelist> - <varlistentry> - <term><parameter>object</parameter></term> - <listitem> - <para> - DateTime object. - </para> - </listitem> - </varlistentry> + &date.datetime.description; <varlistentry> <term><parameter>hour</parameter></term> <listitem> @@ -69,6 +65,46 @@ </para> </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title>Changing the time of a DateTime object</title> + <programlisting role="php"> +<![CDATA[ +<?php +date_default_timezone_set('Europe/London'); + +$datetime = new DateTime('2008-08-03 12:35:23'); +echo $datetime->format('Y-m-d H:i:s') . "\n"; + +$datetime->setTime(14, 55, 24); +echo $datetime->format('Y-m-d H:i:s') . "\n"; + +// Warning: Does not increment the hour! +// This is because the hour has been set (14) - see date_modify() +$datetime->setTime($datetime->format('H'), $datetime->format('n') + 6); +echo $datetime->format('Y-m-d H:i:s') . "\n"; + +// *Does* increment the day, because the day has not been set +$datetime->setTime($datetime->format('H') + 12, $datetime->format('n')); +echo $datetime->format('Y-m-d H:i:s') . "\n"; +?> +]]> + </programlisting> + &example.outputs; + <screen> +<![CDATA[ +2008-08-03 12:35:23 +2008-08-03 14:55:24 +2008-08-03 14:14:00 +2008-08-04 02:08:00 +]]> + </screen> + </example> + </para> + </refsect1> + <refsect1 role="seealso"> &reftitle.seealso; <para> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/datetime/functions/date-timezone-get.xml?r1=1.3&r2=1.4&diff_format=u Index: phpdoc/en/reference/datetime/functions/date-timezone-get.xml diff -u phpdoc/en/reference/datetime/functions/date-timezone-get.xml:1.3 phpdoc/en/reference/datetime/functions/date-timezone-get.xml:1.4 --- phpdoc/en/reference/datetime/functions/date-timezone-get.xml:1.3 Wed Jun 20 22:24:18 2007 +++ phpdoc/en/reference/datetime/functions/date-timezone-get.xml Sun Nov 2 22:11:33 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.3 $ --> +<!-- $Revision: 1.4 $ --> <refentry xml:id="function.date-timezone-get" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>date_timezone_get</refname> @@ -21,14 +21,7 @@ &reftitle.parameters; <para> <variablelist> - <varlistentry> - <term><parameter>object</parameter></term> - <listitem> - <para> - DateTime object. - </para> - </listitem> - </varlistentry> + &date.datetime.description; </variablelist> </para> </refsect1> @@ -40,11 +33,43 @@ </para> </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title>Setting and getting DateTimeZone objects</title> + <programlisting role="php"> +<![CDATA[ +<?php +date_default_timezone_set('Europe/London'); + +$datetime = new DateTime('2008-08-03 12:35:23'); +echo $datetime->getTimezone()->getName() . "\n"; + +$datetime = new DateTime('2008-08-03 12:35:23'); +$la_time = new DateTimeZone('America/Los_Angeles'); +$datetime->setTimezone($la_time); +echo $datetime->getTimezone()->getName(); +?> +]]> + </programlisting> + &example.outputs; + <screen> +<![CDATA[ +Europe/London +America/Los_Angeles +]]> + </screen> + </example> + </para> + </refsect1> + <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>date_timezone_set</function></member> + <member><function>timezone_open</function></member> </simplelist> </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/datetime/functions/date-timezone-set.xml?r1=1.3&r2=1.4&diff_format=u Index: phpdoc/en/reference/datetime/functions/date-timezone-set.xml diff -u phpdoc/en/reference/datetime/functions/date-timezone-set.xml:1.3 phpdoc/en/reference/datetime/functions/date-timezone-set.xml:1.4 --- phpdoc/en/reference/datetime/functions/date-timezone-set.xml:1.3 Wed Jun 20 22:24:18 2007 +++ phpdoc/en/reference/datetime/functions/date-timezone-set.xml Sun Nov 2 22:11:33 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.3 $ --> +<!-- $Revision: 1.4 $ --> <refentry xml:id="function.date-timezone-set" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>date_timezone_set</refname> @@ -22,14 +22,7 @@ &reftitle.parameters; <para> <variablelist> - <varlistentry> - <term><parameter>object</parameter></term> - <listitem> - <para> - DateTime object. - </para> - </listitem> - </varlistentry> + &date.datetime.description; <varlistentry> <term><parameter>timezone</parameter></term> <listitem> @@ -49,11 +42,43 @@ </para> </refsect1> + <refsect1 role="examples"> + &reftitle.examples; + <para> + <example> + <title>Setting and getting DateTimeZone objects</title> + <programlisting role="php"> +<![CDATA[ +<?php +date_default_timezone_set('Europe/London'); + +$datetime = new DateTime('2008-08-03 12:35:23'); +echo $datetime->getTimezone()->getName() . "\n"; + +$datetime = new DateTime('2008-08-03 12:35:23'); +$la_time = new DateTimeZone('America/Los_Angeles'); +$datetime->setTimezone($la_time); +echo $datetime->getTimezone()->getName(); +?> +]]> + </programlisting> + &example.outputs; + <screen> +<![CDATA[ +Europe/London +America/Los_Angeles +]]> + </screen> + </example> + </para> + </refsect1> + <refsect1 role="seealso"> &reftitle.seealso; <para> <simplelist> <member><function>date_timezone_get</function></member> + <member><function>timezone_open</function></member> </simplelist> </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/datetime/functions/timezone-name-get.xml?r1=1.2&r2=1.3&diff_format=u Index: phpdoc/en/reference/datetime/functions/timezone-name-get.xml diff -u phpdoc/en/reference/datetime/functions/timezone-name-get.xml:1.2 phpdoc/en/reference/datetime/functions/timezone-name-get.xml:1.3 --- phpdoc/en/reference/datetime/functions/timezone-name-get.xml:1.2 Wed Jun 20 22:24:18 2007 +++ phpdoc/en/reference/datetime/functions/timezone-name-get.xml Sun Nov 2 22:11:33 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <refentry xml:id="function.timezone-name-get" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>timezone_name_get</refname> @@ -21,14 +21,7 @@ &reftitle.parameters; <para> <variablelist> - <varlistentry> - <term><parameter>object</parameter></term> - <listitem> - <para> - DateTimeZone object. - </para> - </listitem> - </varlistentry> + &date.datetimezone.description; </variablelist> </para> </refsect1> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/datetime/functions/timezone-offset-get.xml?r1=1.4&r2=1.5&diff_format=u Index: phpdoc/en/reference/datetime/functions/timezone-offset-get.xml diff -u phpdoc/en/reference/datetime/functions/timezone-offset-get.xml:1.4 phpdoc/en/reference/datetime/functions/timezone-offset-get.xml:1.5 --- phpdoc/en/reference/datetime/functions/timezone-offset-get.xml:1.4 Wed Jun 20 22:24:18 2007 +++ phpdoc/en/reference/datetime/functions/timezone-offset-get.xml Sun Nov 2 22:11:33 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <refentry xml:id="function.timezone-offset-get" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>timezone_offset_get</refname> @@ -27,14 +27,7 @@ &reftitle.parameters; <para> <variablelist> - <varlistentry> - <term><parameter>object</parameter></term> - <listitem> - <para> - DateTimeZone object. - </para> - </listitem> - </varlistentry> + &date.datetimezone.description; <varlistentry> <term><parameter>datetime</parameter></term> <listitem> http://cvs.php.net/viewvc.cgi/phpdoc/en/reference/datetime/functions/timezone-transitions-get.xml?r1=1.3&r2=1.4&diff_format=u Index: phpdoc/en/reference/datetime/functions/timezone-transitions-get.xml diff -u phpdoc/en/reference/datetime/functions/timezone-transitions-get.xml:1.3 phpdoc/en/reference/datetime/functions/timezone-transitions-get.xml:1.4 --- phpdoc/en/reference/datetime/functions/timezone-transitions-get.xml:1.3 Wed Jun 20 22:24:18 2007 +++ phpdoc/en/reference/datetime/functions/timezone-transitions-get.xml Sun Nov 2 22:11:33 2008 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.3 $ --> +<!-- $Revision: 1.4 $ --> <refentry xml:id="function.timezone-transitions-get" xmlns="http://docbook.org/ns/docbook"> <refnamediv> <refname>timezone_transitions_get</refname> @@ -21,14 +21,7 @@ &reftitle.parameters; <para> <variablelist> - <varlistentry> - <term><parameter>object</parameter></term> - <listitem> - <para> - DateTimeZone object. - </para> - </listitem> - </varlistentry> + &date.datetimezone.description; </variablelist> </para> </refsect1>
« previous php.doc.cvs (#2363) next »