<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.datetime.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'ja',
  ),
  'this' => 
  array (
    0 => 'function.date-sunrise.php',
    1 => 'date_sunrise',
    2 => '指定した日付と場所についての日の出時刻を返す',
  ),
  'up' => 
  array (
    0 => 'ref.datetime.php',
    1 => '日付・時刻 関数',
  ),
  'prev' => 
  array (
    0 => 'function.date-sun-info.php',
    1 => 'date_sun_info',
  ),
  'next' => 
  array (
    0 => 'function.date-sunset.php',
    1 => 'date_sunset',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'ja',
    'path' => 'reference/datetime/functions/date-sunrise.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.date-sunrise" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">date_sunrise</h1>
  <p class="verinfo">(PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">date_sunrise</span> &mdash; <span class="dc-title">
   指定した日付と場所についての日の出時刻を返す
  </span></p>

 </div>

 <div id="function.date-sunrise-refsynopsisdiv">
  <div class="warning"><strong class="warning">警告</strong>
   <p class="para">
    この関数は PHP 8.1.0 で <em>非推奨</em> になります。
    この機能に頼らないことを強く推奨します。
    代わりに <span class="function"><a href="function.date-sun-info.php" class="function">date_sun_info()</a></span> を使ってください。
   </p>
  </div>
 </div>

 <div class="refsect1 description" id="refsect1-function.date-sunrise-description">
  <h3 class="title">説明</h3>
  <div class="methodsynopsis dc-description">
   <span class="attribute"><a href="class.deprecated.php">#[\Deprecated]</a> </span><br>
   <span class="methodname"><strong>date_sunrise</strong></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$timestamp</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$returnFormat</code><span class="initializer"> = <strong><code><a href="datetime.constants.php#constant.sunfuncs-ret-string">SUNFUNCS_RET_STRING</a></code></strong></span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.float.php" class="type float">float</a></span></span> <code class="parameter">$latitude</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.float.php" class="type float">float</a></span></span> <code class="parameter">$longitude</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.float.php" class="type float">float</a></span></span> <code class="parameter">$zenith</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><span class="type"><a href="language.types.null.php" class="type null">?</a></span><span class="type"><a href="language.types.float.php" class="type float">float</a></span></span> <code class="parameter">$utcOffset</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span><br>): <span class="type"><span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>|<span class="type"><a href="language.types.float.php" class="type float">float</a></span>|<span class="type"><a href="language.types.singleton.php" class="type false">false</a></span></span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>date_sunrise()</strong></span> は、与えられた日付
   (<code class="parameter">timestamp</code> で指定する)
   と場所についての日の出の時刻を返します。
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.date-sunrise-parameters">
  <h3 class="title">パラメータ</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">timestamp</code></dt>
     <dd>
      <p class="para">
       日の出時刻を取得する日の
       <code class="parameter">timestamp</code>。
      </p>
     </dd>
    
    
     <dt><code class="parameter">returnFormat</code></dt>
     <dd>
      <p class="para">
       <table class="doctable table">
        <caption><strong><code class="parameter">returnFormat</code> 定数</strong></caption>
        
         <thead>
          <tr>
           <th>定数</th>
           <th>説明</th>
           <th>例</th>
          </tr>

         </thead>

         <tbody class="tbody">
          <tr>
           <td>SUNFUNCS_RET_STRING</td>
           <td>結果を <span class="type"><a href="language.types.string.php" class="type string">string</a></span> で返します。</td>
           <td>16:46</td>
          </tr>

          <tr>
           <td>SUNFUNCS_RET_DOUBLE</td>
           <td>結果を <span class="type"><a href="language.types.float.php" class="type float">float</a></span> で返します。</td>
           <td>16.78243132</td>
          </tr>

          <tr>
           <td>SUNFUNCS_RET_TIMESTAMP</td>
           <td>結果を <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> (タイムスタンプ) で返します。</td>
           <td>1095034606</td>
          </tr>

         </tbody>
        
       </table>

      </p>
     </dd>
    
    
     <dt><code class="parameter">latitude</code></dt>
     <dd>
      <p class="para">
       デフォルトは北緯で、南緯は負の値で表します。
       <a href="datetime.configuration.php#ini.date.default-latitude" class="link">date.default_latitude</a> も参照ください。
      </p>
     </dd>
    
    
     <dt><code class="parameter">longitude</code></dt>
     <dd>
      <p class="para">
       デフォルトは東経で、西経は負の値で表します。
       <a href="datetime.configuration.php#ini.date.default-longitude" class="link">date.default_longitude</a> も参照ください。
      </p>
     </dd>
    
    
     <dt><code class="parameter">zenith</code></dt>
     <dd>
      <p class="para">
       <code class="parameter">zenith</code> は 太陽の中心と、地球の表面からの垂線の間になす角度です。
       デフォルトは <a href="datetime.configuration.php#ini.date.sunrise-zenith" class="link">date.sunrise_zenith</a> です。
       <table class="doctable table">
        <caption><strong>一般的な <code class="parameter">zenith</code> の角度</strong></caption>
        
         <thead>
          <tr>
           <th>角度</th>
           <th>説明</th>
          </tr>

         </thead>

         <tbody class="tbody">
          <tr>
           <td>90°50&#039; </td>
           <td>日の出: 太陽が見えるようになる点</td>
          </tr>

          <tr>
           <td>96°</td>
           <td>市民薄明: 夜明けの始まりを示すのに慣習的に使われます</td>
          </tr>

          <tr>
           <td>102°</td>
           <td>航海薄明: 海の上で、水平線が見えはじめる点</td>
          </tr>

          <tr>
           <td>108°</td>
           <td>天文薄明: 太陽があらゆる明かりの光源になりはじめる点</td>
          </tr>

         </tbody>
        
       </table>

      </p>
     </dd>
    
    
     <dt><code class="parameter">utcOffset</code></dt>
     <dd>
      <p class="para">
       時間単位で指定します。
       <code class="parameter">returnFormat</code> が
       <strong><code><a href="datetime.constants.php#constant.sunfuncs-ret-timestamp">SUNFUNCS_RET_TIMESTAMP</a></code></strong> の場合は、
       <code class="parameter">utcOffset</code> は無視されます。
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.date-sunrise-returnvalues">
  <h3 class="title">戻り値</h3>
  <p class="para">
   日の出時刻を、指定した <code class="parameter">returnFormat</code> で返します。
   失敗した場合に <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> を返します。
   失敗する潜在的な可能性があります。太陽が全く昇らない場合です。
   これは一年のある時期、極圏の中にある場合に起こります。
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-function.date-sunrise-errors">
  <h3 class="title">エラー / 例外</h3>
   
   <p class="para">
すべての日付/時刻関数は、
有効なタイムゾーンが設定されていない場合に <strong><code><a href="errorfunc.constants.php#constant.e-warning">E_WARNING</a></code></strong>
を発生させます。
<span class="function"><a href="function.date-default-timezone-set.php" class="function">date_default_timezone_set()</a></span> も参照ください。</p>
 
 </div>


 <div class="refsect1 changelog" id="refsect1-function.date-sunrise-changelog">
  <h3 class="title">変更履歴</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>バージョン</th>
       <th>説明</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>8.1.0</td>
       <td>
        この関数は、推奨されなくなりました。
        <span class="function"><a href="function.date-sun-info.php" class="function">date_sun_info()</a></span> を代わりに使って下さい。
       </td>
      </tr>

      <tr>
       <td>8.0.0</td>
       <td>
        <code class="parameter">latitude</code>, <code class="parameter">longitude</code>,
        <code class="parameter">zenith</code>, <code class="parameter">utcOffset</code> は、nullable になりました。
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.date-sunrise-examples">
  <h3 class="title">例</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>例1 <span class="function"><strong>date_sunrise()</strong></span> の例</strong></p>
    <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #FF8000">/* ポルトガル リスボンの日の出時刻を計算する<br />緯度: 北緯 38.4<br />経度: 西経 9<br />天頂 ~= 90<br />時差: +1 GMT<br />*/<br /><br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">date</span><span style="color: #007700">(</span><span style="color: #DD0000">"D M d Y"</span><span style="color: #007700">). </span><span style="color: #DD0000">', sunrise time : ' </span><span style="color: #007700">.</span><span style="color: #0000BB">date_sunrise</span><span style="color: #007700">(</span><span style="color: #0000BB">time</span><span style="color: #007700">(), </span><span style="color: #0000BB">SUNFUNCS_RET_STRING</span><span style="color: #007700">, </span><span style="color: #0000BB">38.4</span><span style="color: #007700">, -</span><span style="color: #0000BB">9</span><span style="color: #007700">, </span><span style="color: #0000BB">90</span><span style="color: #007700">, </span><span style="color: #0000BB">1</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">Deprecated: Constant SUNFUNCS_RET_STRING is deprecated in script on line 10
Deprecated: Function date_sunrise() is deprecated since 8.1, use date_sun_info() instead in script on line 10
Mon Dec 20 2004, sunrise time : 08:54</pre>
</div>
    </div>
   </div>
   <div class="example" id="example-2">
    <p><strong>例2 No sunrise</strong></p>
    <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$solstice </span><span style="color: #007700">= </span><span style="color: #0000BB">strtotime</span><span style="color: #007700">(</span><span style="color: #DD0000">'2017-12-21'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">date_sunrise</span><span style="color: #007700">(</span><span style="color: #0000BB">$solstice</span><span style="color: #007700">, </span><span style="color: #0000BB">SUNFUNCS_RET_STRING</span><span style="color: #007700">, </span><span style="color: #0000BB">69.245833</span><span style="color: #007700">, -</span><span style="color: #0000BB">53.537222</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">Deprecated: Constant SUNFUNCS_RET_STRING is deprecated in script on line 3
Deprecated: Function date_sunrise() is deprecated since 8.1, use date_sun_info() instead in script on line 3
bool(false)</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.date-sunrise-seealso">
  <h3 class="title">参考</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.date-sun-info.php" class="function" rel="rdfs-seeAlso">date_sun_info()</a> - 日の出/日の入り時刻と薄明 (twilight) の開始/終了時刻の情報を含む配列を返す</span></li>
   </ul>
  </p>
 </div>

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