<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="datetimeimmutable.setisodate" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
 <refnamediv>
  <refname>DateTimeImmutable::setISODate</refname>
  <refpurpose>Sets the ISO date</refpurpose>
 </refnamediv>

 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis role="DateTimeImmutable">
   <modifier>public</modifier> <type>DateTimeImmutable</type><methodname>DateTimeImmutable::setISODate</methodname>
   <methodparam><type>int</type><parameter>year</parameter></methodparam>
   <methodparam><type>int</type><parameter>week</parameter></methodparam>
   <methodparam choice="opt"><type>int</type><parameter>dayOfWeek</parameter><initializer>1</initializer></methodparam>
  </methodsynopsis>
  <para>
   Returns a new DateTimeImmutable object with the date set according to the
   ISO 8601 standard - using weeks and day offsets rather than specific dates.
  </para>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <variablelist>
   <varlistentry>
    <term><parameter>year</parameter></term>
    <listitem>
     <para>
      Year of the date.
     </para>
    </listitem>
   </varlistentry>
   <varlistentry>
    <term><parameter>week</parameter></term>
    <listitem>
     <para>
      Week of the date.
     </para>
    </listitem>
   </varlistentry>
   <varlistentry>
    <term><parameter>dayOfWeek</parameter></term>
    <listitem>
     <para>
      Offset from the first day of the week.
     </para>
    </listitem>
   </varlistentry>
  </variablelist>
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   &date.datetimeimmutable.return.modifiedobject;
  </para>
 </refsect1>

 <refsect1 role="examples">
  &reftitle.examples;
  <example>
   <title><function>DateTimeImmutable::setISODate</function> example</title>
   <para>&style.oop;</para>
   <programlisting role="php">
<![CDATA[
<?php
$date = new DateTimeImmutable();

$date->setISODate(2008, 2);
echo $date->format('Y-m-d') . "\n";

$date->setISODate(2008, 2, 7);
echo $date->format('Y-m-d') . "\n";
?>
]]>
   </programlisting>
   <para>&style.procedural;</para>
   <programlisting role="php">
<![CDATA[
<?php
$date = date_create();

date_isodate_set($date, 2008, 2);
echo date_format($date, 'Y-m-d') . "\n";

date_isodate_set($date, 2008, 2, 7);
echo date_format($date, 'Y-m-d') . "\n";
?>
]]>
   </programlisting>
   &examples.outputs;
   <screen>
<![CDATA[
2008-01-07
2008-01-13
]]>
   </screen>
  </example>
  <example>
   <title>Values exceeding ranges are added to their parent values</title>
   <programlisting role="php">
<![CDATA[
<?php
$date = new DateTimeImmutable();

$newDate = $date->setISODate(2008, 2, 7);
echo $newDate->format('Y-m-d') . "\n";

$newDate = $date->setISODate(2008, 2, 8);
echo $newDate->format('Y-m-d') . "\n";

$newDate = $date->setISODate(2008, 53, 7);
echo $newDate->format('Y-m-d') . "\n";
?>
]]>
   </programlisting>
   &example.outputs;
   <screen>
<![CDATA[
2008-01-13
2008-01-14
2009-01-04
]]>
   </screen>
  </example>
  <example>
   <title>Finding the month a week is in</title>
   <programlisting role="php">
<![CDATA[
<?php
$date = new DateTimeImmutable();
$newDate = $date->setISODate(2008, 14);
echo $newDate->format('n');
?>
]]>
   </programlisting>
   &examples.outputs;
   <screen>
<![CDATA[
3
]]>
   </screen>
  </example>
 </refsect1>

 <refsect1 role="seealso">
  &reftitle.seealso;
  <simplelist>
   <member><function>DateTimeImmutable::setDate</function></member>
   <member><function>DateTimeImmutable::setTime</function></member>
  </simplelist>
 </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
-->
