2009-11-19 13:13:35 +00:00
|
|
|
<?xml version="1.0" encoding="utf-8"?>
|
2009-07-11 06:46:52 +00:00
|
|
|
<!-- $Revision$ -->
|
2009-01-06 14:55:00 +00:00
|
|
|
|
|
|
|
<refentry xml:id="datetime.getoffset" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
|
|
<refnamediv>
|
2013-05-17 18:17:21 +00:00
|
|
|
<refname>DateTime::getOffset</refname>
|
|
|
|
<refname>DateTimeImmutable::getOffset</refname>
|
2013-05-17 06:06:10 +00:00
|
|
|
<refname>DateTimeInterface::getOffset</refname>
|
2011-06-25 19:38:40 +00:00
|
|
|
<refname>date_offset_get</refname>
|
2009-11-13 21:29:26 +00:00
|
|
|
<refpurpose>Returns the timezone offset</refpurpose>
|
2009-01-06 14:55:00 +00:00
|
|
|
</refnamediv>
|
2010-04-25 14:15:28 +00:00
|
|
|
|
2009-01-06 14:55:00 +00:00
|
|
|
<refsect1 role="description">
|
|
|
|
&reftitle.description;
|
2010-04-25 14:15:28 +00:00
|
|
|
<para>&style.oop;</para>
|
2010-05-13 15:33:37 +00:00
|
|
|
<methodsynopsis role="oop">
|
2013-05-17 18:17:21 +00:00
|
|
|
<modifier>public</modifier> <type>int</type><methodname>DateTime::getOffset</methodname>
|
|
|
|
<void />
|
|
|
|
</methodsynopsis>
|
|
|
|
<methodsynopsis role="DateTimeImmutable">
|
|
|
|
<modifier>public</modifier> <type>int</type><methodname>DateTimeImmutable::getOffset</methodname>
|
|
|
|
<void />
|
|
|
|
</methodsynopsis>
|
|
|
|
<methodsynopsis role="DateTimeInterface">
|
2013-05-17 06:06:10 +00:00
|
|
|
<modifier>public</modifier> <type>int</type><methodname>DateTimeInterface::getOffset</methodname>
|
2009-01-06 14:55:00 +00:00
|
|
|
<void />
|
|
|
|
</methodsynopsis>
|
2010-04-25 14:15:28 +00:00
|
|
|
<para>&style.procedural;</para>
|
2010-05-18 17:08:30 +00:00
|
|
|
<methodsynopsis role="procedural">
|
2009-01-06 14:55:00 +00:00
|
|
|
<type>int</type><methodname>date_offset_get</methodname>
|
2013-05-17 06:06:10 +00:00
|
|
|
<methodparam><type>DateTimeInterface</type><parameter>object</parameter></methodparam>
|
2009-01-06 14:55:00 +00:00
|
|
|
</methodsynopsis>
|
2010-04-29 02:18:36 +00:00
|
|
|
<para>
|
|
|
|
Returns the timezone offset.
|
|
|
|
</para>
|
2009-01-06 14:55:00 +00:00
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="parameters">
|
|
|
|
&reftitle.parameters;
|
2010-04-23 03:06:33 +00:00
|
|
|
<variablelist>
|
|
|
|
&date.datetime.description;
|
|
|
|
</variablelist>
|
2009-01-06 14:55:00 +00:00
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="returnvalues">
|
|
|
|
&reftitle.returnvalues;
|
|
|
|
<para>
|
2010-05-04 17:21:29 +00:00
|
|
|
Returns the timezone offset in seconds from UTC on success
|
2009-11-13 21:29:26 +00:00
|
|
|
&return.falseforfailure;.
|
2009-01-06 14:55:00 +00:00
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1 role="examples">
|
|
|
|
&reftitle.examples;
|
2010-04-23 03:06:33 +00:00
|
|
|
<example>
|
2010-04-28 15:58:26 +00:00
|
|
|
<title><function>DateTime::getOffset</function> example</title>
|
|
|
|
<para>&style.oop;</para>
|
2010-04-23 03:06:33 +00:00
|
|
|
<programlisting role="php">
|
2009-01-06 14:55:00 +00:00
|
|
|
<![CDATA[
|
|
|
|
<?php
|
2010-04-24 20:01:05 +00:00
|
|
|
$winter = new DateTime('2010-12-21', new DateTimeZone('America/New_York'));
|
|
|
|
$summer = new DateTime('2008-06-21', new DateTimeZone('America/New_York'));
|
2009-01-06 14:55:00 +00:00
|
|
|
|
2010-04-28 15:58:26 +00:00
|
|
|
echo $winter->getOffset() . "\n";
|
|
|
|
echo $summer->getOffset() . "\n";
|
2009-01-06 14:55:00 +00:00
|
|
|
?>
|
|
|
|
]]>
|
2010-04-23 03:06:33 +00:00
|
|
|
</programlisting>
|
2010-04-28 15:58:26 +00:00
|
|
|
<para>&style.procedural;</para>
|
|
|
|
<programlisting role="php">
|
|
|
|
<![CDATA[
|
|
|
|
<?php
|
2010-10-02 19:08:23 +00:00
|
|
|
$winter = date_create('2010-12-21', timezone_open('America/New_York'));
|
|
|
|
$summer = date_create('2008-06-21', timezone_open('America/New_York'));
|
2010-04-28 15:58:26 +00:00
|
|
|
|
2012-02-25 16:17:59 +00:00
|
|
|
echo date_offset_get($winter) . "\n";
|
|
|
|
echo date_offset_get($summer) . "\n";
|
2010-04-28 15:58:26 +00:00
|
|
|
?>
|
|
|
|
]]>
|
|
|
|
</programlisting>
|
|
|
|
&examples.outputs;
|
|
|
|
<screen>
|
|
|
|
<![CDATA[
|
|
|
|
-18000
|
|
|
|
-14400
|
|
|
|
]]>
|
|
|
|
</screen>
|
|
|
|
<para>
|
|
|
|
Note: -18000 = -5 hours, -14400 = -4 hours.
|
|
|
|
</para>
|
2010-04-23 03:06:33 +00:00
|
|
|
</example>
|
2009-01-06 14:55:00 +00:00
|
|
|
</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
|
2009-09-25 07:04:39 +00:00
|
|
|
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
|
2009-01-06 14:55:00 +00:00
|
|
|
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
|
|
|
|
-->
|