Files
doc-fr/reference/datetime/dateperiod/construct.xml
George Peter Banyard d157d6b96d Sync docs with EN
2021-05-24 01:11:51 +01:00

227 lines
6.5 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<!-- EN-Revision: e2c7b3635d5353c05c248c29038bf9d5b7133d6e Maintainer: jpauli Status: ready -->
<!-- Reviewed: no -->
<!-- CREDITS: DavidA -->
<refentry xml:id="dateperiod.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>DatePeriod::__construct</refname>
<refpurpose>Crée un nouvel objet <classname>DatePeriod</classname></refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<constructorsynopsis role="oop">
<modifier>public</modifier> <methodname>DatePeriod::__construct</methodname>
<methodparam><type>DateTimeInterface</type><parameter>start</parameter></methodparam>
<methodparam><type>DateInterval</type><parameter>interval</parameter></methodparam>
<methodparam><type>int</type><parameter>recurrences</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>options</parameter><initializer>0</initializer></methodparam>
</constructorsynopsis>
<constructorsynopsis role="oop">
<modifier>public</modifier> <methodname>DatePeriod::__construct</methodname>
<methodparam><type>DateTimeInterface</type><parameter>start</parameter></methodparam>
<methodparam><type>DateInterval</type><parameter>interval</parameter></methodparam>
<methodparam><type>DateTimeInterface</type><parameter>end</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>options</parameter><initializer>0</initializer></methodparam>
</constructorsynopsis>
<constructorsynopsis role="oop">
<modifier>public</modifier> <methodname>DatePeriod::__construct</methodname>
<methodparam><type>string</type><parameter>isostr</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>options</parameter><initializer>0</initializer></methodparam>
</constructorsynopsis>
<para>
Crée un nouvel objet <classname>DatePeriod</classname>.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>start</parameter></term>
<listitem>
<para>
La date de début de la période.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>interval</parameter></term>
<listitem>
<para>
L'intervalle entre les récurrences de la période.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>recurrences</parameter></term>
<listitem>
<para>
Le nombre de récurrences. Doit être plus grand que <literal>0</literal>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>end</parameter></term>
<listitem>
<para>
La date de fin de la période.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>isostr</parameter></term>
<listitem>
<para>
Une <link xlink:href="&url.iso-8601.repeating_intervals;">spécification
ISO 8601 de la répétition de l'intervalle</link>.
Les occurrences zéro (<literal>R0/</literal>) ne sont pas supportée.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>options</parameter></term>
<listitem>
<para>
Peut être configuré à <constant>DatePeriod::EXCLUDE_START_DATE</constant>
pour exclure la date de début du jeu de dates de récursion dans
la période.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<para>
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>7.2.19, 7.3.6, 7.4.0</entry>
<entry>
<parameter>recurrences</parameter> doit désormais être plus grand que <literal>0</literal>.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Exemple avec DatePeriod</title>
<programlisting role="php">
<![CDATA[
<?php
$start = new DateTime('2012-07-01');
$interval = new DateInterval('P7D');
$end = new DateTime('2012-07-31');
$recurrences = 4;
$iso = 'R4/2012-07-01T00:00:00Z/P7D';
// Toutes ces périodes sont équivalentes.
$period = new DatePeriod($start, $interval, $recurrences);
$period = new DatePeriod($start, $interval, $end);
$period = new DatePeriod($iso);
// En parcourant l'objet DatePeriod, toutes les
// dates de la récursion pour la période seront affichées.
foreach ($period as $date) {
echo $date->format('Y-m-d')."\n";
}
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
2012-07-01
2012-07-08
2012-07-15
2012-07-22
2012-07-29
]]>
</screen>
</example>
</para>
<para>
<example>
<title>Exemple avec DatePeriod et <constant>DatePeriod::EXCLUDE_START_DATE</constant></title>
<programlisting role="php">
<![CDATA[
<?php
$start = new DateTime('2012-07-01');
$interval = new DateInterval('P7D');
$end = new DateTime('2012-07-31');
$period = new DatePeriod($start, $interval, $end,
DatePeriod::EXCLUDE_START_DATE);
// En parcourant l'objet DatePeriod,
// toutes les dates de récursion pour la période sont affichées.
// Notez que, dans ce cas, 2012-07-01 ne sera pas affiché.
foreach ($period as $date) {
echo $date->format('Y-m-d')."\n";
}
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
2012-07-08
2012-07-15
2012-07-22
2012-07-29
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="notes">
&reftitle.notes;
<simpara>
Les nombres de répétitions non liés spécifiés dans la section 4.5
"Intervalle de temps récurrent" de la norme ISO 8601 ne sont pas
supportés, c'est-à-dire ni <literal>"R/..."</literal> comme
<parameter>isostr</parameter> ni &null; comme
<parameter>end</parameter> ne fonctionnerait.
</simpara>
</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
-->