php-doc-en/reference/intl/dateformatter/settimezone.xml

156 lines
3.6 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="intldateformatter.settimezone" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>IntlDateFormatter::setTimeZone</refname>
<refname>datefmt_set_timezone</refname>
<refpurpose>Sets formatterʼs timezone</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<para>
&style.oop;
</para>
<methodsynopsis>
<modifier>public</modifier>
<type>bool</type>
<methodname>IntlDateFormatter::setTimeZone</methodname>
<methodparam><type>mixed</type><parameter>zone</parameter></methodparam>
</methodsynopsis>
<para>
&style.procedural;
</para>
<methodsynopsis>
<type>bool</type>
<methodname>datefmt_set_timezone</methodname>
<methodparam><type>IntlDateFormatter</type><parameter>fmt</parameter></methodparam>
<methodparam><type>mixed</type><parameter>zone</parameter></methodparam>
</methodsynopsis>
<para>
Sets the timezone used for the IntlDateFormatter.
object.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>fmt</parameter></term>
<listitem>
<para>
The formatter resource.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>zone</parameter></term>
<listitem>
<para>
The timezone to use for this formatter. This can be specified in the
following forms:
</para>
&reference.intl.inctimezoneparam;
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<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 ", $formatter->getTimeZone()->getId(), "\n";
$formatter->setTimeZone(IntlTimeZone::createTimeZone('Europe/Lisbon'));
echo "IntlTimeZone\n ", $formatter->getTimeZone()->getId(), "\n";
$formatter->setTimeZone(new DateTimeZone('Europe/Paris'));
echo "DateTimeZone\n ", $formatter->getTimeZone()->getId(), "\n";
$formatter->setTimeZone('Europe/Rome');
echo "String\n ", $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
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
-->