<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.datetimeinterface.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'ja',
  ),
  'this' => 
  array (
    0 => 'datetime.getoffset.php',
    1 => 'DateTimeInterface::getOffset',
    2 => 'タイムゾーンのオフセットを返す',
  ),
  'up' => 
  array (
    0 => 'class.datetimeinterface.php',
    1 => 'DateTimeInterface',
  ),
  'prev' => 
  array (
    0 => 'datetime.format.php',
    1 => 'DateTimeInterface::format',
  ),
  'next' => 
  array (
    0 => 'datetime.gettimestamp.php',
    1 => 'DateTimeInterface::getTimestamp',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'ja',
    'path' => 'reference/datetime/datetimeinterface/getoffset.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="datetime.getoffset" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">DateTimeInterface::getOffset</h1>
  <h1 class="refname">DateTimeImmutable::getOffset</h1>
  <h1 class="refname">DateTime::getOffset</h1>
  <h1 class="refname">date_offset_get</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.2.0, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">DateTimeInterface::getOffset</span> -- <span class="refname">DateTimeImmutable::getOffset</span> -- <span class="refname">DateTime::getOffset</span> -- <span class="refname">date_offset_get</span> &mdash; <span class="dc-title">タイムゾーンのオフセットを返す</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-datetime.getoffset-description">
  <h3 class="title">説明</h3>
  <p class="para">オブジェクト指向型</p>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="methodname"><strong>DateTimeInterface::getOffset</strong></span>(): <span class="type"><a href="language.types.integer.php" class="type int">int</a></span></div>

  <div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><strong>DateTimeImmutable::getOffset</strong></span>(): <span class="type"><a href="language.types.integer.php" class="type int">int</a></span></div>

  <div class="methodsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><strong>DateTime::getOffset</strong></span>(): <span class="type"><a href="language.types.integer.php" class="type int">int</a></span></div>

  <p class="para rdfs-comment">手続き型</p>
  <div class="methodsynopsis dc-description"><span class="methodname"><a href="function.date-offset-get.php" class="methodname">date_offset_get</a></span>(<span class="methodparam"><span class="type"><a href="class.datetimeinterface.php" class="type DateTimeInterface">DateTimeInterface</a></span> <code class="parameter">$object</code></span>): <span class="type"><a href="language.types.integer.php" class="type int">int</a></span></div>

  <p class="para rdfs-comment">
   タイムゾーンのオフセットを返します。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-datetime.getoffset-parameters">
  <h3 class="title">パラメータ</h3>
  <dl>
   <dt><code class="parameter">
object</code></dt><dd><p class="para">手続き型のみ: <span class="function"><a href="function.date-create.php" class="function">date_create()</a></span>
が返す <span class="classname"><a href="class.datetime.php" class="classname">DateTime</a></span> オブジェクト</p></dd>
  </dl>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-datetime.getoffset-returnvalues">
  <h3 class="title">戻り値</h3>
  <p class="para">
   成功した場合には UTC からのタイムゾーンオフセット秒数、
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-datetime.getoffset-examples">
  <h3 class="title">例</h3>
  <div class="example" id="example-1">
   <p><strong>例1 <span class="function"><strong>DateTime::getOffset()</strong></span> の例</strong></p>
   <div class="example-contents"><p>オブジェクト指向型</p></div>
   <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$winter </span><span style="color: #007700">= new </span><span style="color: #0000BB">DateTimeImmutable</span><span style="color: #007700">(</span><span style="color: #DD0000">'2010-12-21'</span><span style="color: #007700">, new </span><span style="color: #0000BB">DateTimeZone</span><span style="color: #007700">(</span><span style="color: #DD0000">'America/New_York'</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">$summer </span><span style="color: #007700">= new </span><span style="color: #0000BB">DateTimeImmutable</span><span style="color: #007700">(</span><span style="color: #DD0000">'2008-06-21'</span><span style="color: #007700">, new </span><span style="color: #0000BB">DateTimeZone</span><span style="color: #007700">(</span><span style="color: #DD0000">'America/New_York'</span><span style="color: #007700">));<br /><br />echo </span><span style="color: #0000BB">$winter</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getOffset</span><span style="color: #007700">() . </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />echo </span><span style="color: #0000BB">$summer</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getOffset</span><span style="color: #007700">() . </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;</span></span></code></div>
   </div>

   <div class="example-contents"><p>上の例の出力は以下となります。</p></div>
   <div class="example-contents screen">
<div class="annotation-interactive examplescode"><pre class="examplescode">-18000
-14400</pre>
</div>
   </div>
   <div class="example-contents"><p>手続き型</p></div>
   <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$winter </span><span style="color: #007700">= </span><span style="color: #0000BB">date_create</span><span style="color: #007700">(</span><span style="color: #DD0000">'2010-12-21'</span><span style="color: #007700">, </span><span style="color: #0000BB">timezone_open</span><span style="color: #007700">(</span><span style="color: #DD0000">'America/New_York'</span><span style="color: #007700">));<br /></span><span style="color: #0000BB">$summer </span><span style="color: #007700">= </span><span style="color: #0000BB">date_create</span><span style="color: #007700">(</span><span style="color: #DD0000">'2008-06-21'</span><span style="color: #007700">, </span><span style="color: #0000BB">timezone_open</span><span style="color: #007700">(</span><span style="color: #DD0000">'America/New_York'</span><span style="color: #007700">));<br /><br />echo </span><span style="color: #0000BB">date_offset_get</span><span style="color: #007700">(</span><span style="color: #0000BB">$winter</span><span style="color: #007700">) . </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />echo </span><span style="color: #0000BB">date_offset_get</span><span style="color: #007700">(</span><span style="color: #0000BB">$summer</span><span style="color: #007700">) . </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;</span></span></code></div>
   </div>

   <div class="example-contents"><p>上の例の出力は以下となります。</p></div>
   <div class="example-contents screen">
<div class="annotation-interactive examplescode"><pre class="examplescode">-18000
-14400</pre>
</div>
   </div>
   <div class="example-contents"><p>
    Note: -18000 = -5 hours, -14400 = -4 hours.
   </p></div>
  </div>
 </div>


</div><?php manual_footer($setup); ?>