1
0
mirror of https://github.com/php/doc-ru.git synced 2026-03-27 01:02:19 +01:00
Files
archived-doc-ru/reference/datetime/datetimeinterface/getoffset.xml
2021-01-05 20:16:26 +03:00

137 lines
3.8 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?xml version="1.0" encoding="utf-8"?>
<!-- EN-Revision: 2424a1acccc1a23533927f3200d461831a31e310 Maintainer: shein Status: ready -->
<!-- Reviewed: yes Maintainer: lex -->
<!-- $Revision$ -->
<refentry xml:id="datetime.getoffset" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>DateTime::getOffset</refname>
<refname>DateTimeImmutable::getOffset</refname>
<refname>DateTimeInterface::getOffset</refname>
<refname>date_offset_get</refname>
<refpurpose>Возвращает смещение временной зоны</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<para>&style.oop;</para>
<methodsynopsis role="oop">
<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">
<modifier>public</modifier> <type>int</type><methodname>DateTimeInterface::getOffset</methodname>
<void/>
</methodsynopsis>
<para>&style.procedural;</para>
<methodsynopsis role="procedural">
<type>int</type><methodname>date_offset_get</methodname>
<methodparam><type>DateTimeInterface</type><parameter>object</parameter></methodparam>
</methodsynopsis>
<para>
Возвращает смещение временной зоны.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
&date.datetime.description;
</variablelist>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
В случае успешного выполнения возвращает смещение часовой зоны относительно UTC в секундах.
</para>
</refsect1>
<refsect1 role="changelog">
&reftitle.changelog;
<informaltable>
<tgroup cols="2">
<thead>
<row>
<entry>&Version;</entry>
<entry>&Description;</entry>
</row>
</thead>
<tbody>
<row>
<entry>8.0.0</entry>
<entry>
До этой версии, в случае возникновения ошибки возвращалось &false;.
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title>Пример использования <function>DateTime::getOffset</function></title>
<para>&style.oop;</para>
<programlisting role="php">
<![CDATA[
<?php
$winter = new DateTime('2010-12-21', new DateTimeZone('America/New_York'));
$summer = new DateTime('2008-06-21', new DateTimeZone('America/New_York'));
echo $winter->getOffset() . "\n";
echo $summer->getOffset() . "\n";
?>
]]>
</programlisting>
<para>&style.procedural;</para>
<programlisting role="php">
<![CDATA[
<?php
$winter = date_create('2010-12-21', timezone_open('America/New_York'));
$summer = date_create('2008-06-21', timezone_open('America/New_York'));
echo date_offset_get($winter) . "\n";
echo date_offset_get($summer) . "\n";
?>
]]>
</programlisting>
&examples.outputs;
<screen>
<![CDATA[
-18000
-14400
]]>
</screen>
<para>
Замечание: -18000 = -5 часов, -14400 = -4 часа.
</para>
</example>
</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
-->