mirror of
https://github.com/php/doc-es.git
synced 2026-04-27 17:14:09 +02:00
321 lines
10 KiB
XML
321 lines
10 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- EN-Revision: 3a8c3e77df070a046c9d5b56b68926ca2d7e5ee3 Maintainer: PhilDaiguille Status: ready -->
|
|
<!-- Reviewed: no Maintainer: Marqitos -->
|
|
<reference xml:id="class.dateperiod" role="class" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
|
|
|
|
<title>La clase DatePeriod</title>
|
|
<titleabbrev>DatePeriod</titleabbrev>
|
|
|
|
<partintro>
|
|
|
|
<!-- {{{ DatePeriod intro -->
|
|
<section xml:id="dateperiod.intro">
|
|
&reftitle.intro;
|
|
<para>
|
|
Representa un período de fechas.
|
|
</para>
|
|
<para>
|
|
Un período de fechas permite iterar a través
|
|
de un conjunto de fechas y horas, ocurriendo a intervalos regulares,
|
|
durante un período determinado.
|
|
</para>
|
|
</section>
|
|
<!-- }}} -->
|
|
|
|
<section xml:id="dateperiod.synopsis">
|
|
&reftitle.classsynopsis;
|
|
|
|
<!-- {{{ Synopsis -->
|
|
<classsynopsis class="class">
|
|
<ooclass>
|
|
<classname>DatePeriod</classname>
|
|
</ooclass>
|
|
|
|
<oointerface>
|
|
<modifier>implements</modifier>
|
|
<interfacename>IteratorAggregate</interfacename>
|
|
</oointerface>
|
|
|
|
<classsynopsisinfo role="comment">&Constants;</classsynopsisinfo>
|
|
<fieldsynopsis>
|
|
<modifier>public</modifier>
|
|
<modifier>const</modifier>
|
|
<type>int</type>
|
|
<varname linkend="dateperiod.constants.exclude-start-date">DatePeriod::EXCLUDE_START_DATE</varname>
|
|
</fieldsynopsis>
|
|
<fieldsynopsis>
|
|
<modifier>public</modifier>
|
|
<modifier>const</modifier>
|
|
<type>int</type>
|
|
<varname linkend="dateperiod.constants.include-end-date">DatePeriod::INCLUDE_END_DATE</varname>
|
|
</fieldsynopsis>
|
|
|
|
<classsynopsisinfo role="comment">&Properties;</classsynopsisinfo>
|
|
<fieldsynopsis>
|
|
<modifier>public</modifier>
|
|
<modifier>readonly</modifier>
|
|
<type class="union"><type>DateTimeInterface</type><type>null</type></type>
|
|
<varname linkend="dateperiod.props.start">start</varname>
|
|
</fieldsynopsis>
|
|
<fieldsynopsis>
|
|
<modifier>public</modifier>
|
|
<modifier>readonly</modifier>
|
|
<type class="union"><type>DateTimeInterface</type><type>null</type></type>
|
|
<varname linkend="dateperiod.props.current">current</varname>
|
|
</fieldsynopsis>
|
|
<fieldsynopsis>
|
|
<modifier>public</modifier>
|
|
<modifier>readonly</modifier>
|
|
<type class="union"><type>DateTimeInterface</type><type>null</type></type>
|
|
<varname linkend="dateperiod.props.end">end</varname>
|
|
</fieldsynopsis>
|
|
<fieldsynopsis>
|
|
<modifier>public</modifier>
|
|
<modifier>readonly</modifier>
|
|
<type class="union"><type>DateInterval</type><type>null</type></type>
|
|
<varname linkend="dateperiod.props.interval">interval</varname>
|
|
</fieldsynopsis>
|
|
<fieldsynopsis>
|
|
<modifier>public</modifier>
|
|
<modifier>readonly</modifier>
|
|
<type>int</type>
|
|
<varname linkend="dateperiod.props.recurrences">recurrences</varname>
|
|
</fieldsynopsis>
|
|
<fieldsynopsis>
|
|
<modifier>public</modifier>
|
|
<modifier>readonly</modifier>
|
|
<type>bool</type>
|
|
<varname linkend="dateperiod.props.include-start-date">include_start_date</varname>
|
|
</fieldsynopsis>
|
|
<fieldsynopsis>
|
|
<modifier>public</modifier>
|
|
<modifier>readonly</modifier>
|
|
<type>bool</type>
|
|
<varname linkend="dateperiod.props.include-end-date">include_end_date</varname>
|
|
</fieldsynopsis>
|
|
|
|
<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
|
|
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.dateperiod')/db:refentry/db:refsect1[@role='description']/descendant::db:constructorsynopsis[@role='DatePeriod'])">
|
|
<xi:fallback/>
|
|
</xi:include>
|
|
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.dateperiod')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[@role='DatePeriod'])">
|
|
<xi:fallback/>
|
|
</xi:include>
|
|
</classsynopsis>
|
|
<!-- }}} -->
|
|
|
|
</section>
|
|
|
|
<!-- {{{ DatePeriod constants -->
|
|
<section xml:id="dateperiod.constants">
|
|
&reftitle.constants;
|
|
<variablelist>
|
|
<varlistentry xml:id="dateperiod.constants.exclude-start-date">
|
|
<term>
|
|
<constant>DatePeriod::EXCLUDE_START_DATE</constant>
|
|
<type>int</type>
|
|
</term>
|
|
<listitem>
|
|
<para>Excluye la fecha de inicio, utilizada por <function>DatePeriod::__construct</function>.</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
|
|
<varlistentry xml:id="dateperiod.constants.include-end-date">
|
|
<term>
|
|
<constant>DatePeriod::INCLUDE_END_DATE</constant>
|
|
<type>int</type>
|
|
</term>
|
|
<listitem>
|
|
<para>Incluye la fecha de fin, utilizada por <function>DatePeriod::__construct</function>.</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
</section>
|
|
<!-- }}} -->
|
|
|
|
<section xml:id="dateperiod.props">
|
|
&reftitle.properties;
|
|
<variablelist>
|
|
<varlistentry xml:id="dateperiod.props.recurrences">
|
|
<term><varname>recurrences</varname></term>
|
|
<listitem>
|
|
<para>
|
|
La cantidad mínima de instancias devueltas por el iterador.
|
|
</para>
|
|
<para>
|
|
Si el número de recurrencias ha sido explícitamente pasado
|
|
mediante el argumento <literal>$recurrences</literal> en el constructor de la instancia
|
|
<classname>DatePeriod</classname>, entonces esta propiedad contiene ese valor,
|
|
<emphasis>más</emphasis> uno si la fecha de inicio no ha sido desactivada por
|
|
<constant>DatePeriod::EXCLUDE_START_DATE</constant>, <emphasis>más</emphasis>
|
|
uno si la fecha de fin ha sido activada por
|
|
<constant>DatePeriod::INCLUDE_END_DATE</constant>.
|
|
</para>
|
|
<para>
|
|
Si el número de recurrencias no ha sido explícitamente pasado, entonces esta
|
|
propiedad contiene el número mínimo de instancias devueltas. Esto sería
|
|
<literal>0</literal>, <emphasis>más</emphasis> uno si la fecha de inicio no
|
|
ha sido desactivada por <constant>DatePeriod::EXCLUDE_START_DATE</constant>,
|
|
<emphasis>más</emphasis> uno si la fecha de fin ha sido activada por
|
|
<constant>DatePeriod::INCLUDE_END_DATE</constant>.
|
|
</para>
|
|
<para>
|
|
<informalexample>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$start = new DateTime('2018-12-31 00:00:00');
|
|
$end = new DateTime('2021-12-31 00:00:00');
|
|
$interval = new DateInterval('P1M');
|
|
$recurrences = 5;
|
|
|
|
// recurrencias explícitamente definidas por el constructor
|
|
$period = new DatePeriod($start, $interval, $recurrences, DatePeriod::EXCLUDE_START_DATE);
|
|
echo $period->recurrences, "\n";
|
|
|
|
$period = new DatePeriod($start, $interval, $recurrences);
|
|
echo $period->recurrences, "\n";
|
|
|
|
$period = new DatePeriod($start, $interval, $recurrences, DatePeriod::INCLUDE_END_DATE);
|
|
echo $period->recurrences, "\n";
|
|
|
|
// recurrencias no definidas en el constructor
|
|
$period = new DatePeriod($start, $interval, $end);
|
|
echo $period->recurrences, "\n";
|
|
|
|
$period = new DatePeriod($start, $interval, $end, DatePeriod::EXCLUDE_START_DATE);
|
|
echo $period->recurrences, "\n";
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs;
|
|
<screen role="php">
|
|
<![CDATA[
|
|
5
|
|
6
|
|
7
|
|
1
|
|
0
|
|
]]>
|
|
</screen>
|
|
</informalexample>
|
|
</para>
|
|
<para>
|
|
Ver también <methodname>DatePeriod::getRecurrences</methodname>.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry xml:id="dateperiod.props.include-end-date">
|
|
<term><varname>include_end_date</varname></term>
|
|
<listitem>
|
|
<para>
|
|
Incluye o no la fecha de fin en el conjunto de fechas recurrentes.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry xml:id="dateperiod.props.include-start-date">
|
|
<term><varname>include_start_date</varname></term>
|
|
<listitem>
|
|
<para>
|
|
Si se debe incluir la fecha de inicio en el conjunto de fechas recurrentes
|
|
o no.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry xml:id="dateperiod.props.start">
|
|
<term><varname>start</varname></term>
|
|
<listitem>
|
|
<para>
|
|
La fecha de inicio del período.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry xml:id="dateperiod.props.current">
|
|
<term><varname>current</varname></term>
|
|
<listitem>
|
|
<para>
|
|
Durante la iteración, esto contendrá la fecha del día en el período.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry xml:id="dateperiod.props.end">
|
|
<term><varname>end</varname></term>
|
|
<listitem>
|
|
<para>
|
|
La fecha de fin del período.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry xml:id="dateperiod.props.interval">
|
|
<term><varname>interval</varname></term>
|
|
<listitem>
|
|
<para>
|
|
Una especificación de intervalo repetitivo ISO 8601.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</section>
|
|
|
|
<section role="changelog">
|
|
&reftitle.changelog;
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>8.4.0</entry>
|
|
<entry>
|
|
Las constantes de clase ahora están tipadas.
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>8.2.0</entry>
|
|
<entry>
|
|
La constante <constant>DatePeriod::INCLUDE_END_DATE</constant> y
|
|
la propiedad <property>include_end_date</property> han sido añadidas.
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>8.0.0</entry>
|
|
<entry>
|
|
La clase <classname>DatePeriod</classname> ahora implementa <interfacename>IteratorAggregate</interfacename>.
|
|
Anteriormente, solo <interfacename>Traversable</interfacename> era implementada.
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</section>
|
|
|
|
</partintro>
|
|
|
|
&reference.datetime.entities.dateperiod;
|
|
|
|
</reference>
|
|
<!-- 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
|
|
-->
|