1
0
mirror of https://github.com/php/doc-ru.git synced 2026-03-25 16:22:18 +01:00
Files
archived-doc-ru/reference/datetime/datetimezone/getoffset.xml
2022-12-28 08:15:19 +03:00

107 lines
3.9 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: e057f1f552548a68030830e96ae1bdf313b1794e Maintainer: das Status: ready -->
<!-- Reviewed: no -->
<refentry xml:id="datetimezone.getoffset" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>DateTimeZone::getOffset</refname>
<refname>timezone_offset_get</refname>
<refpurpose>Возвращает смещение часового пояса от UTC (GMT)</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<para>&style.oop;</para>
<methodsynopsis role="DateTimeZone">
<modifier>public</modifier> <type>int</type><methodname>DateTimeZone::getOffset</methodname>
<methodparam><type>DateTimeInterface</type><parameter>datetime</parameter></methodparam>
</methodsynopsis>
<para>&style.procedural;</para>
<methodsynopsis>
<type>int</type><methodname>timezone_offset_get</methodname>
<methodparam><type>DateTimeZone</type><parameter>object</parameter></methodparam>
<methodparam><type>DateTimeInterface</type><parameter>datetime</parameter></methodparam>
</methodsynopsis>
<para>
Эта функция возвращает смещение от GMT для даты/времени, указанных в параметре
<parameter>datetime</parameter>. GMT-смещение рассчитывается с помощью информации
о часовом поясе, содержащейся в используемом объекте DateTimeZone.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
&date.datetimezone.description;
<varlistentry>
<term><parameter>datetime</parameter></term>
<listitem>
<para>
DateTime, содержащий дату/время, относительно которых вычисляется смещение.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Возвращает смещение часового пояса в секундах.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Пример использования <function>DateTimeZone::getOffset</function></title>
<programlisting role="php">
<![CDATA[
<?php
// Создание двух объектов timezone, один для Тайбэй (Тайвань) и один для
// Токио (Япония)
$dateTimeZoneTaipei = new DateTimeZone("Asia/Taipei");
$dateTimeZoneJapan = new DateTimeZone("Asia/Tokyo");
// Создание двух объектов DateTime, которые будут содержать одинаковые метки времени Unix, но
// имеющих различные часовые пояса.
$dateTimeTaipei = new DateTime("now", $dateTimeZoneTaipei);
$dateTimeJapan = new DateTime("now", $dateTimeZoneJapan);
// Вычисление смещения от GMT для даты/времени, содержащихся в объекте $dateTimeTaipei,
// но с использованием правил часового пояса, определённых для Токио
// ($dateTimeZoneJapan).
$timeOffset = $dateTimeZoneJapan->getOffset($dateTimeTaipei);
// Должен показать int(32400) (для дат после Sat Sep 8 01:00:00 1951 JST).
var_dump($timeOffset);
?>
]]>
</programlisting>
</example>
</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
-->