svn: /pear/peardoc/trunk/en/package/datetime/date/ basics.xml examples.xml
[email protected] (Christian Weiske)
| Newsgroups | php.pear.doc |
|---|---|
| Message-ID | <[email protected]> |
cweiske Wed, 14 Oct 2009 21:06:03 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=289643
Log:
fix doc bug #15029: large Date_Spans cannot be created
Bug: http://pear.php.net/bugs/15029 (unknown)
Changed paths:
U pear/peardoc/trunk/en/package/datetime/date/basics.xml
U pear/peardoc/trunk/en/package/datetime/date/examples.xml
svn-diffs-289643.txt
(text/x-diff, 15.2 KB)
Modified: pear/peardoc/trunk/en/package/datetime/date/basics.xml
===================================================================
--- pear/peardoc/trunk/en/package/datetime/date/basics.xml 2009-10-14 19:54:00 UTC (rev 289642)
+++ pear/peardoc/trunk/en/package/datetime/date/basics.xml 2009-10-14 21:06:03 UTC (rev 289643)
@@ -1,16 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
-<refentry xmlns="http://docbook.org/ns/docbook" version="lillet" xml:id="package.datetime.date.basics">
+<refentry xmlns="http://docbook.org/ns/docbook"
+ xmlns:phd="http://www.php.net/ns/phd"
+ version="lillet"
+ xml:id="package.datetime.date.basics"
+>
<refnamediv>
<refname>Basics</refname>
<refpurpose>How to get information</refpurpose>
</refnamediv>
- <refsection xml:id="package.datetime.date.basics.intro"><info><title>Introduction</title></info>
+ <refsection xml:id="package.datetime.date.basics.intro">
+ <info><title>Introduction</title></info>
-
<para>
The auto-generated
- <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="&phpdocbase.datetime-date;">API documentation</link>
+ <phd:pearapi phd:package="Date">API documentation</phd:pearapi>
is very valuable to get information
about this packages' methods and which parameters they require.
But of course you first need to have an overview about the abilities
@@ -19,9 +23,9 @@
</refsection>
- <refsection xml:id="package.datetime.date.basics.getting"><info><title>Getting data</title></info>
+ <refsection xml:id="package.datetime.date.basics.getting">
+ <info><title>Getting data</title></info>
-
<para>
There are a number of simple getter methods that let you retrieve
single pieces of a date currently set.
@@ -30,32 +34,32 @@
<itemizedlist>
<listitem>
<para>
- <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="&phpdocbase.datetime-date.method;getYear"><methodname>getYear</methodname></link>
+ <phd:pearapi phd:package="Date" phd:linkend="Date::getYear"/>
</para>
</listitem>
<listitem>
<para>
- <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="&phpdocbase.datetime-date.method;getMonth"><methodname>getMonth</methodname></link>
+ <phd:pearapi phd:package="Date" phd:linkend="Date::getMonth"/>
</para>
</listitem>
<listitem>
<para>
- <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="&phpdocbase.datetime-date.method;getDay"><methodname>getDay</methodname></link>
+ <phd:pearapi phd:package="Date" phd:linkend="Date::getDay"/>
</para>
</listitem>
<listitem>
<para>
- <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="&phpdocbase.datetime-date.method;getHour"><methodname>getHour</methodname></link>
+ <phd:pearapi phd:package="Date" phd:linkend="Date::getHour"/>
</para>
</listitem>
<listitem>
<para>
- <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="&phpdocbase.datetime-date.method;getMinute"><methodname>getMinute</methodname></link>
+ <phd:pearapi phd:package="Date" phd:linkend="Date::getMinute"/>
</para>
</listitem>
<listitem>
<para>
- <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="&phpdocbase.datetime-date.method;getSecond"><methodname>getSecond</methodname></link>
+ <phd:pearapi phd:package="Date" phd:linkend="Date::getSecond"/>
</para>
</listitem>
</itemizedlist>
@@ -68,41 +72,41 @@
<itemizedlist>
<listitem>
<para>
- <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="&phpdocbase.datetime-date.method;getDayName"><methodname>getDayName</methodname></link>
+ <phd:pearapi phd:package="Date" phd:linkend="Date::getDayName"/>
returns the name of the day in short (<literal>Mon</literal>)
or long form (<literal>Monday</literal>)
</para>
</listitem>
<listitem>
<para>
- <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="&phpdocbase.datetime-date.method;getMonthName"><methodname>getMonthName</methodname></link>
+ <phd:pearapi phd:package="Date" phd:linkend="Date::getMonthName"/>
returns the name of the month in short (<literal>Jan</literal>) or
long form (<literal>January</literal>)
</para>
</listitem>
<listitem>
<para>
- <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="&phpdocbase.datetime-date.method;getDayOfWeek"><methodname>getDayOfWeek</methodname></link>
+ <phd:pearapi phd:package="Date" phd:linkend="Date::getDayOfWeek"/>
calculates the number of the day in the week (0-6, Sunday being 0)
</para>
</listitem>
<listitem>
<para>
- <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="&phpdocbase.datetime-date.method;getWeekOfYear"><methodname>getWeekOfYear</methodname></link>
+ <phd:pearapi phd:package="Date" phd:linkend="Date::getWeekOfYear"/>
returns the week number of this date
</para>
</listitem>
<listitem>
<para>
- <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="&phpdocbase.datetime-date.method;getQuarterOfYear"><methodname>getQuarterOfYear</methodname></link>
+ <phd:pearapi phd:package="Date" phd:linkend="Date::getQuarterOfYear"/>
</para>
</listitem>
</itemizedlist>
</refsection>
- <refsection xml:id="package.datetime.date.basics.navigation"><info><title>Navigating between dates</title></info>
-
+ <refsection xml:id="package.datetime.date.basics.navigation">
+ <info><title>Navigating between dates</title></info>
<para>
The following method all return a new date object.
@@ -111,36 +115,30 @@
<itemizedlist>
<listitem>
<para>
- <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="&phpdocbase.datetime-date.method;getNextDay"><methodname>getNextDay</methodname></link>
+ <phd:pearapi phd:package="Date" phd:linkend="Date::getNextDay"/>
</para>
</listitem>
<listitem>
<para>
- <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="&phpdocbase.datetime-date.method;getPrevDay"><methodname>getPrevDay</methodname></link>
+ <phd:pearapi phd:package="Date" phd:linkend="Date::getPrevDay"/>
</para>
</listitem>
<listitem>
<para>
- <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="&phpdocbase.datetime-date.method;getNextWeekday"><methodname>getNextWeekday</methodname></link>
+ <phd:pearapi phd:package="Date" phd:linkend="Date::getNextWeekday"/>
</para>
</listitem>
<listitem>
<para>
- <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="&phpdocbase.datetime-date.method;getPrevWeekday"><methodname>getPrevWeekday</methodname></link>
+ <phd:pearapi phd:package="Date" phd:linkend="Date::getPrevWeekday"/>
</para>
</listitem>
-<!--
- <listitem>
- <para>
- <ulink url="&phpdocbase.datetime-date.method;"><methodname></methodname></ulink>
- </para>
- </listitem>
--->
</itemizedlist>
<para>
You can also do excact calculations by adding and subtracting intervals.
- The <literal>*Span</literal> methods require a <classname>Date_Span</classname>
+ The <literal>*Span</literal> methods require a
+ <phd:pearapi phd:package="Date" phd:linkend="Date_Span"/>
object to be passed as only parameter while the others take
a number representing seconds.
</para>
@@ -148,26 +146,37 @@
<itemizedlist>
<listitem>
<para>
- <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="&phpdocbase.datetime-date.method;addSeconds"><methodname>addSeconds</methodname></link>
+ <phd:pearapi phd:package="Date" phd:linkend="Date::addSeconds"/>
</para>
</listitem>
<listitem>
<para>
- <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="&phpdocbase.datetime-date.method;subtractSeconds"><methodname>subtractSeconds</methodname></link>
+ <phd:pearapi phd:package="Date" phd:linkend="Date::subtractSeconds"/>
</para>
</listitem>
<listitem>
<para>
- <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="&phpdocbase.datetime-date.method;addSpan"><methodname>addSpan</methodname></link>
+ <phd:pearapi phd:package="Date" phd:linkend="Date::addSpan"/>
</para>
</listitem>
<listitem>
<para>
- <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="&phpdocbase.datetime-date.method;subtractSpan"><methodname>subtractSpan</methodname></link>
+ <phd:pearapi phd:package="Date" phd:linkend="Date::subtractSpan"/>
</para>
</listitem>
</itemizedlist>
+ <warning>
+ <para>
+ <phd:pearapi phd:package="Date" phd:linkend="Date_Span"/>
+ works, unlike
+ <phd:pearapi phd:package="Date" phd:linkend="Date"/>,
+ internally with integers, which means that you have a precision of 32 bit
+ or ~68 years.
+ Date span objects with more that 67 years will lead to unexpected results!
+ </para>
+ </warning>
+
</refsection>
</refentry>
Modified: pear/peardoc/trunk/en/package/datetime/date/examples.xml
===================================================================
--- pear/peardoc/trunk/en/package/datetime/date/examples.xml 2009-10-14 19:54:00 UTC (rev 289642)
+++ pear/peardoc/trunk/en/package/datetime/date/examples.xml 2009-10-14 21:06:03 UTC (rev 289643)
@@ -1,24 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
-<refentry xmlns="http://docbook.org/ns/docbook" version="lillet" xml:id="package.datetime.date.examples">
+<refentry xmlns="http://docbook.org/ns/docbook"
+ xmlns:phd="http://www.php.net/ns/phd"
+ version="lillet"
+ xml:id="package.datetime.date.examples"
+>
<refnamediv>
<refname>Examples</refname>
<refpurpose>Learning by doing</refpurpose>
</refnamediv>
- <refsection xml:id="package.datetime.date.examples.intro"><info><title>Introduction</title></info>
-
+ <refsection xml:id="package.datetime.date.examples.intro">
+ <info><title>Introduction</title></info>
+
<para>
Following the saying "learning by doing", we start with some examples.
</para>
<para>
The first step to work with the class is to instantiate a
- <classname>Date</classname> object.
+ <phd:pearapi phd:package="Date" phd:linkend="Date"/>,
+ object.
</para>
- <example><info><title>Creating a Date object</title></info>
-
+ <example>
+ <info><title>Creating a Date object</title></info>
<programlisting role="php"><![CDATA[
<?php
require_once 'Date.php';
@@ -43,13 +49,13 @@
After finishing your work with the date object, you probably want to
have it back. This can be done in different ways, for example by
using
- <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="&phpdocbase.datetime-date.method;getTime"><methodname>getTime</methodname></link>
+ <phd:pearapi phd:package="Date" phd:linkend="Date::getTime">getTime()</phd:pearapi>
or
- <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="&phpdocbase.datetime-date.method;getDate"><methodname>getDate</methodname></link>.
+ <phd:pearapi phd:package="Date" phd:linkend="Date::getDate">getDate()</phd:pearapi>
</para>
- <example><info><title>Getting the date in different formats</title></info>
-
+ <example>
+ <info><title>Getting the date in different formats</title></info>
<programlisting role="php"><![CDATA[
<?php
require_once 'Date.php';
@@ -78,23 +84,24 @@
</refsection>
- <refsection xml:id="package.datetime.date.examples.timediff"><info><title>Calculating a time difference</title></info>
+ <refsection xml:id="package.datetime.date.examples.timediff">
+ <info><title>Calculating a time difference</title></info>
<para>
You often have the task to know which time span lies between two dates.
With <classname>Date</classname>, this is easy to accomplish.
First we use
- <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="&phpdocbase.datetime-date_span.method;setFromDateDiff"><methodname>setFromDateDiff</methodname></link>
+ <phd:pearapi phd:package="Date" phd:linkend="Date::setFromDateDiff">setFromDateDiff()</phd:pearapi>
on a fresh
<classname>Date_Span</classname> object and then
- <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="&phpdocbase.datetime-date_span.method;toDays"><methodname>toDays</methodname></link>
+ <phd:pearapi phd:package="Date" phd:linkend="Date::toDays">toDays()</phd:pearapi>
to get the exact number of days
between the two dates.
</para>
- <example><info><title>Calculating a time span</title></info>
-
+ <example>
+ <info><title>Calculating a time span</title></info>
<programlisting role="php"><![CDATA[
<?php
require_once 'Date.php';
@@ -114,25 +121,26 @@
]]></programlisting>
</example>
- <note>
+ <warning>
<para>
- <classname>Date_Span</classname> works, unlike <classname>Date</classname>,
+ <phd:pearapi phd:package="Date" phd:linkend="Date_Span"/>
+ works, unlike
+ <phd:pearapi phd:package="Date" phd:linkend="Date"/>,
internally with integers, which means that you have a precision of 32 bit
- or 68 years.
+ or ~68 years.
+ Date span objects with more that 67 years will lead to unexpected results!
</para>
- </note>
+ </warning>
</refsection>
-
-
- <refsection xml:id="package.datetime.date.examples.converttimezone"><info><title>Converting timezones</title></info>
+ <refsection xml:id="package.datetime.date.examples.converttimezone">
+ <info><title>Converting timezones</title></info>
-
<para>
<classname>Date</classname> can help you working with time zones.
An array with all supported timezones can be retrieved by using
- <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="&phpdocbase.datetime-date_timezone.method;getAvailableIDs"><methodname>getAvailableIDs</methodname></link>
+ <phd:pearapi phd:package="Date" phd:linkend="Date_Timezone::getAvailableIDs"/>,
statically as in
<command>$list = Date_TimeZone::getAvailableIDs();</command>.
</para>
@@ -141,14 +149,15 @@
<methodname>convertTZ</methodname> converts the Date object's
internal settings to the given time zone.
Using
- <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="&phpdocbase.datetime-date.method;format"><methodname>format</methodname></link>
+ <phd:pearapi phd:package="Date" phd:linkend="Date::format">format()</phd:pearapi>
you can display the timezone
setting. With <classname>Date_TimeZone</classname>'s
<methodname>getDefault</methodname> method the default time
zone for this computer can be obtained.
</para>
- <example><info><title>Converting timezones</title></info>
+ <example>
+ <info><title>Converting timezones</title></info>
<programlisting role="php"><![CDATA[
<?php
@@ -180,17 +189,18 @@
- <refsection xml:id="package.datetime.date.examples.sorting"><info><title>Sorting an array of dates</title></info>
-
+ <refsection xml:id="package.datetime.date.examples.sorting">
+ <info><title>Sorting an array of dates</title></info>
<para>
Once you have an array of <classname>Date</classname> objects, you
might want to sort it. The class provides a static method
- <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="&phpdocbase.datetime-date.method;compare"><methodname>compare</methodname></link>
+ <phd:pearapi phd:package="Date" phd:linkend="Date::compare">compare()</phd:pearapi>
that helps with this.
</para>
- <example><info><title>Sorting dates</title></info>
+ <example>
+ <info><title>Sorting dates</title></info>
<programlisting role="php"><![CDATA[
<?php