Document IntlDateFormatter::setTimeZone()

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@330515 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Gustavo André dos Santos Lopes 2013-06-16 00:22:23 +00:00
parent 8b5c6b1498
commit e7bbcdc9f5

View file

@ -5,7 +5,7 @@
<refnamediv>
<refname>IntlDateFormatter::setTimeZone</refname>
<refname>datefmt_set_timezone</refname>
<refpurpose>Sets formatter's timezone</refpurpose>
<refpurpose>Sets formatterʼs timezone</refpurpose>
</refnamediv>
<refsect1 role="description">
@ -28,7 +28,10 @@
<methodparam><type>mixed</type><parameter>zone</parameter></methodparam>
</methodsynopsis>
&warn.undocumented.func;
<para>
Sets the timezone that will be used when formatting dates or times with this
object.
</para>
</refsect1>
@ -39,8 +42,36 @@
<term><parameter>zone</parameter></term>
<listitem>
<para>
The timezone to use for this formatter. This can be specified in the
following forms:
</para>
<itemizedlist>
<listitem>
<para>
&null;, in which case the default timezone will be used, as specified in
the ini setting <link linkend="ini.date.timezone">date.timezone</link>.
</para>
</listitem>
<listitem>
<para>
An <classname>IntlTimeZone</classname>, which will be used directly.
</para>
</listitem>
<listitem>
<para>
A <classname>DateTimeZone</classname>. Its identifier will be extracted
and an ICU timezone object will be created; the timezone will be backed
by ICUʼs database, not PHPʼs.
</para>
</listitem>
<listitem>
<para>
A <type>string</type>, which should be a valid ICU timezone identifier.
See <function>IntlTimeZone::createTimeZoneIDEnumeration</function>. Raw
offsets such as <literal>"GMT+08:30"</literal> are also accepted.
</para>
</listitem>
</itemizedlist>
</listitem>
</varlistentry>
</variablelist>
@ -49,11 +80,74 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns &true; on success and &false; on failure.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title><function>IntlDateFormatter::setTimeZone</function> examples</title>
<programlisting role="php">
<![CDATA[
<?php
ini_set('date.timezone', 'Europe/Amsterdam');
$formatter = IntlDateFormatter::create(NULL, NULL, NULL, "UTC");
$formatter->setTimeZone(NULL);
echo "NULL\n\t", $formatter->getTimeZone()->getId(), "\n";
$formatter->setTimeZone(IntlTimeZone::createTimeZone('Europe/Lisbon'));
echo "IntlTimeZone\n\t", $formatter->getTimeZone()->getId(), "\n";
$formatter->setTimeZone(new DateTimeZone('Europe/Paris'));
echo "DateTimeZone\n\t", $formatter->getTimeZone()->getId(), "\n";
$formatter->setTimeZone('Europe/Rome');
echo "String\n\t", $formatter->getTimeZone()->getId(), "\n";
$formatter->setTimeZone('GMT+00:30');
print_r($formatter->getTimeZone());
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
NULL
Europe/Amsterdam
IntlTimeZone
Europe/Lisbon
DateTimeZone
Europe/Paris
String
Europe/Rome
IntlTimeZone Object
(
[valid] => 1
[id] => GMT+00:30
[rawOffset] => 1800000
[currentOffset] => 1800000
)
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>IntlDateFormatter::getTimeZone</function></member>
</simplelist>
</para>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file