mirror of
https://github.com/php/doc-es.git
synced 2026-03-27 08:52:15 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/es/trunk@336298 c90b9560-bf6c-de11-be94-00142212c4b1
226 lines
6.1 KiB
XML
226 lines
6.1 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: 6ce419d15e103640378ae0efcb720c3128a47c8a Maintainer: seros Status: ready -->
|
|
<!-- Reviewed: no Maintainer: seros -->
|
|
|
|
<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>Crea un nuevo objeto DatePeriod</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></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></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></methodparam>
|
|
</constructorsynopsis>
|
|
<para>
|
|
Crea un nuevo objeto DatePeriod.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term><parameter>start</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
La fecha de inicio del periodo.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>interval</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
El intervalo entre repeticiones dentro del periodo.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>recurrences</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
El número de repeticiones.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>end</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
La fecha final del periodo.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>isostr</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Una especificación ISO 8601 del intervalo de repetición.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term><parameter>options</parameter></term>
|
|
<listitem>
|
|
<para>
|
|
Se puede establecer a <constant>DatePeriod::EXCLUDE_START_DATE</constant> para
|
|
excluir la fecha de inicio del conjunto de fechas de repetición dentro del
|
|
periodo.
|
|
</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>5.5.8</entry>
|
|
<entry>
|
|
El tipo de <parameter>end</parameter> se cambió a
|
|
<interfacename>DateTimeImmutable</interfacename>.
|
|
Anteriormente era <classname>DateTime</classname>.
|
|
</entry>
|
|
</row>
|
|
<row>
|
|
<entry>5.5.0</entry>
|
|
<entry>
|
|
<parameter>start</parameter> se cambió a
|
|
<interfacename>DateTimeImmutable</interfacename>.
|
|
Anteriormente era <classname>DateTime</classname>.
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<para>
|
|
<example>
|
|
<title>Ejemplo de DatePeriod</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$inicio = new DateTime('2012-07-01');
|
|
$intervalo = new DateInterval('P7D');
|
|
$fin = new DateTime('2012-07-31');
|
|
$repeticiones = 4;
|
|
$iso = 'R4/2012-07-01T00:00:00Z/P7D';
|
|
|
|
// Todos estos periodos son equivalentes.
|
|
$periodo = new DatePeriod($inicio, $intervalo, $repeticiones);
|
|
$periodo = new DatePeriod($inicio, $intervalo, $fin);
|
|
$periodo = new DatePeriod($iso);
|
|
|
|
// Al recorrer el objeto DatePeriod, se imprimen todas
|
|
// las fechas de repetición dentro del periodo.
|
|
foreach ($periodo as $fecha) {
|
|
echo $fecha->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>Ejemplo de DatePeriod con <constant>DatePeriod::EXCLUDE_START_DATE</constant></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$inicio = new DateTime('2012-07-01');
|
|
$intervalo = new DateInterval('P7D');
|
|
$fin = new DateTime('2012-07-31');
|
|
|
|
$periodo = new DatePeriod($inicio, $intervalo, $fin,
|
|
DatePeriod::EXCLUDE_START_DATE);
|
|
|
|
// Al recorrer el objeto DatePeriod, se imprimen todas
|
|
// las fechas de repetición dentro del periodo.
|
|
// Observe que, en este caso, 2012-07-01 no se imprime.
|
|
foreach ($periodo as $fecha) {
|
|
echo $fecha->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>
|
|
|
|
</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
|
|
-->
|