php-doc-en/reference/datetime/functions/date-default-timezone-get.xml
Torben Wilson af4410a7e1 Normalized the sgml-default-dtd-file local-variable line for those
still using this, after discussion on the phpdoc list.
From now on, manual.ced will need to be found at ~/.phpdoc/manual.ced.



git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@288721 c90b9560-bf6c-de11-be94-00142212c4b1
2009-09-25 07:04:39 +00:00

137 lines
3.2 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<refentry xml:id="function.date-default-timezone-get" xmlns="http://docbook.org/ns/docbook">
<refnamediv>
<refname>date_default_timezone_get</refname>
<refpurpose>
Gets the default timezone used by all date/time functions in a script
</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>string</type><methodname>date_default_timezone_get</methodname>
<void/>
</methodsynopsis>
<para>
In order of preference, this function returns the default timezone by:
<itemizedlist>
<listitem>
<para>
Reading the timezone set using the
<function>date_default_timezone_set</function> function (if any)
</para>
</listitem>
<listitem>
<para>
Reading the <varname>TZ</varname> environment variable (if non empty)
</para>
</listitem>
<listitem>
<para>
Reading the value of the <link linkend="ini.date.timezone">date.timezone</link> ini option
(if set)
</para>
</listitem>
<listitem>
<para>
Querying the host operating system (if supported and allowed by the OS)
</para>
</listitem>
</itemizedlist>
</para>
<para>
If none of the above succeed, <methodname>date_default_timezone_get</methodname>
will return a default timezone of <literal>UTC</literal>.
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Returns a <type>string</type>.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Getting the default timezone</title>
<programlisting role="php">
<![CDATA[
<?php
date_default_timezone_set('Europe/London');
if (date_default_timezone_get()) {
echo 'date_default_timezone_set: ' . date_default_timezone_get() . '<br />';
}
if (ini_get('date.timezone')) {
echo 'date.timezone: ' . ini_get('date.timezone');
}
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
date_default_timezone_set: Europe/London
date.timezone: Europe/London
]]>
</screen>
</example>
</para>
<para>
<example>
<title>Getting the abbreviation of a timezone</title>
<programlisting role="php">
<![CDATA[
<?php
date_default_timezone_set('America/Los_Angeles');
echo date_default_timezone_get() . ' => ' . date('e') . ' => ' . date('T');
?>
]]>
</programlisting>
&example.outputs;
<screen>
<![CDATA[
America/Los_Angeles => America/Los_Angeles => PST
]]>
</screen>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>date_default_timezone_set</function></member>
<member><xref linkend="timezones" /></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
-->