<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="intlcalendar.add" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
 <refnamediv>
  <refname>IntlCalendar::add</refname>
  <refpurpose>Add a (signed) amount of time to a field</refpurpose>
 </refnamediv>

 <refsect1 role="description">
  &reftitle.description;
  <para>
   &style.oop;
  </para>
  <methodsynopsis role="IntlCalendar">
   <modifier>public</modifier> <type>bool</type><methodname>IntlCalendar::add</methodname>
   <methodparam><type>int</type><parameter>field</parameter></methodparam>
   <methodparam><type>int</type><parameter>value</parameter></methodparam>
  </methodsynopsis>
  <para>
   &style.procedural;
  </para>
  <methodsynopsis>
   <type>bool</type><methodname>intlcal_add</methodname>
   <methodparam><type>IntlCalendar</type><parameter>calendar</parameter></methodparam>
   <methodparam><type>int</type><parameter>field</parameter></methodparam>
   <methodparam><type>int</type><parameter>value</parameter></methodparam>
  </methodsynopsis>
  <para>
   Add a signed amount to a field. Adding a positive amount allows advances in
   time, even if the numeric value of the field decreases (e.g. when working
   with years in BC dates).
  </para>
  <para>
   Other fields may need to adjusted – for instance, adding a month to the 31st
   of January will result in the 28th (or 29th) of February. Contrary to
   <function>IntlCalendar::roll</function>, when a value wraps around, more
   significant fields may change. For instance, adding a day to the 31st of
   January will result in the 1st of February, not the 1st of January.
  </para>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <variablelist>
   <varlistentry>
    <term><parameter>calendar</parameter></term>
    <listitem>
     &intl.parameter.intl-calendar;
    </listitem>
   </varlistentry>
   <varlistentry>
    <term><parameter>field</parameter></term>
    <listitem>
     &reference.intl.incfieldparam;
    </listitem>
   </varlistentry>
   <varlistentry>
    <term><parameter>value</parameter></term>
    <listitem>
     <para>
      The signed amount to add to the current field. If the amount is positive,
      the instant will be moved forward; if it is negative, the instant will be
      moved into the past. The unit is implicit to the field type. For instance,
      hours for <constant>IntlCalendar::FIELD_HOUR_OF_DAY</constant>.
     </para>
    </listitem>
   </varlistentry>
  </variablelist>
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   Returns &true; on success&return.falseforfailure;.
  </para>
 </refsect1>


 <refsect1 role="examples">
  &reftitle.examples;
  <para>
   <example>
   <title><function>IntlCalendar::add</function></title>
    <programlisting role="php">
<![CDATA[
<?php
ini_set('intl.default_locale', 'fr_FR');
ini_set('date.timezone', 'UTC');

$cal = new IntlGregorianCalendar(2012, 0 /* January */, 31);
echo IntlDateFormatter::formatObject($cal), "\n";

$cal->add(IntlCalendar::FIELD_MONTH, 1);
echo IntlDateFormatter::formatObject($cal), "\n";

$cal->add(IntlCalendar::FIELD_DAY_OF_MONTH, 1);
echo IntlDateFormatter::formatObject($cal), "\n";
]]>
    </programlisting>
    &example.outputs;
    <screen>
<![CDATA[
31 janv. 2012 00:00:00
29 févr. 2012 00:00:00
1 mars 2012 00:00:00
]]>
    </screen>
   </example>
  </para>
 </refsect1>

</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
