Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 2494

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Returns time of sunrise for a given day and location</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.date-sun-info.html">date_sun_info</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.date-sunset.html">date_sunset</a></div>
 <div class="up"><a href="ref.datetime.html">Date/Time Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="function.date-sunrise" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">date_sunrise</h1>
  <p class="verinfo">(PHP 5)</p><p class="refpurpose"><span class="refname">date_sunrise</span> &mdash; <span class="dc-title">Returns time of sunrise for a given day and location</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.date-sunrise-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <span class="methodname"><strong>date_sunrise</strong></span>
    ( <span class="methodparam"><span class="type">int</span> <code class="parameter">$timestamp</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$format</code><span class="initializer"> = SUNFUNCS_RET_STRING</span></span>
   [, <span class="methodparam"><span class="type">float</span> <code class="parameter">$latitude</code><span class="initializer"> = ini_get(&quot;date.default_latitude&quot;)</span></span>
   [, <span class="methodparam"><span class="type">float</span> <code class="parameter">$longitude</code><span class="initializer"> = ini_get(&quot;date.default_longitude&quot;)</span></span>
   [, <span class="methodparam"><span class="type">float</span> <code class="parameter">$zenith</code><span class="initializer"> = ini_get(&quot;date.sunrise_zenith&quot;)</span></span>
   [, <span class="methodparam"><span class="type">float</span> <code class="parameter">$gmt_offset</code><span class="initializer"> = 0</span></span>
  ]]]]] )</div>

  <p class="para rdfs-comment">
    <span class="function"><strong>date_sunrise()</strong></span> returns the sunrise time for a given
   day (specified as a <em><code class="parameter">timestamp</code></em>) and location.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.date-sunrise-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   <dl>

    <dt>

     <span class="term"><em><code class="parameter">timestamp</code></em></span>
     <dd>

      <p class="para">
       The <em><code class="parameter">timestamp</code></em> of the day from which the sunrise
       time is taken.
      </p>
     </dd>

    </dt>

    <dt>

     <span class="term"><em><code class="parameter">format</code></em></span>
     <dd>

      <p class="para">
       <table class="doctable table">
        <caption><strong><em><code class="parameter">format</code></em> constants</strong></caption>
        
         <thead>
          <tr>
           <th>constant</th>
           <th>description</th>
           <th>example</th>
          </tr>

         </thead>

         <tbody class="tbody">
          <tr>
           <td>SUNFUNCS_RET_STRING</td>
           <td>returns the result as <span class="type"><a href="language.types.string.html" class="type string">string</a></span></td>
           <td>16:46</td>
          </tr>

          <tr>
           <td>SUNFUNCS_RET_DOUBLE</td>
           <td>returns the result as <span class="type"><a href="language.types.float.html" class="type float">float</a></span></td>
           <td>16.78243132</td>
          </tr>

          <tr>
           <td>SUNFUNCS_RET_TIMESTAMP</td>
           <td>returns the result as <span class="type"><a href="language.types.integer.html" class="type integer">integer</a></span> (timestamp)</td>
           <td>1095034606</td>
          </tr>

         </tbody>
        
       </table>

      </p>
     </dd>

    </dt>

    <dt>

     <span class="term"><em><code class="parameter">latitude</code></em></span>
     <dd>

      <p class="para">
       Defaults to North, pass in a negative value for South.
       See also: <em>date.default_latitude</em>
      </p>
     </dd>

    </dt>

    <dt>

     <span class="term"><em><code class="parameter">longitude</code></em></span>
     <dd>

      <p class="para">
       Defaults to East, pass in a negative value for West.
       See also: <em>date.default_longitude</em>
      </p>
     </dd>

    </dt>

    <dt>

     <span class="term"><em><code class="parameter">zenith</code></em></span>
     <dd>

      <p class="para">
       Default: <em>date.sunrise_zenith</em>
      </p>
     </dd>

    </dt>

    <dt>

     <span class="term"><em><code class="parameter">gmtoffset</code></em></span>
     <dd>

      <p class="para">
       Specified in hours.
      </p>
     </dd>

    </dt>

   </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.date-sunrise-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns the sunrise time in a specified <em><code class="parameter">format</code></em> on
   success or <strong><code>FALSE</code></strong> on failure.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-function.date-sunrise-errors">
  <h3 class="title">Errors/Exceptions</h3>
   
   <p class="para">
Every call to a date/time function will generate a <strong><code>E_NOTICE</code></strong>
if the time zone is not valid, and/or a <strong><code>E_STRICT</code></strong>
or <strong><code>E_WARNING</code></strong> message
if using the system settings or the <var class="varname"><var class="varname">TZ</var></var> environment
variable. See also  <span class="function"><a href="function.date-default-timezone-set.html" class="function">date_default_timezone_set()</a></span></p>
 
 </div>


 <div class="refsect1 changelog" id="refsect1-function.date-sunrise-changelog">
  <h3 class="title">Changelog</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>Version</th>
       <th>Description</th>
      </tr>

     </thead>

     <tbody class="tbody">
      
      <tr><td>5.1.0</td><td><p class="para">
Now issues the <strong><code>E_STRICT</code></strong> and <strong><code>E_NOTICE</code></strong>
time zone errors.</p></td></tr>

     
     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.date-sunrise-examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   <div class="example" id="example-2299">
    <p><strong>Example #1  <span class="function"><strong>date_sunrise()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #FF8000">/*&nbsp;calculate&nbsp;the&nbsp;sunrise&nbsp;time&nbsp;for&nbsp;Lisbon,&nbsp;Portugal<br />Latitude:&nbsp;38.4&nbsp;North<br />Longitude:&nbsp;9&nbsp;West<br />Zenith&nbsp;~=&nbsp;90<br />offset:&nbsp;+1&nbsp;GMT<br />*/<br /><br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #0000BB">date</span><span style="color: #007700">(</span><span style="color: #DD0000">"D&nbsp;M&nbsp;d&nbsp;Y"</span><span style="color: #007700">).&nbsp;</span><span style="color: #DD0000">',&nbsp;sunrise&nbsp;time&nbsp;:&nbsp;'&nbsp;</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">(),&nbsp;</span><span style="color: #0000BB">SUNFUNCS_RET_STRING</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">38.4</span><span style="color: #007700">,&nbsp;-</span><span style="color: #0000BB">9</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">90</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents"><p>The above example will output
something similar to:</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
Mon Dec 20 2004, sunrise time : 08:54
</pre></div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.date-sunrise-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"> <span class="function"><a href="function.date-sunset.html" class="function" rel="rdfs-seeAlso">date_sunset()</a> - Returns time of sunset for a given day and location</span></li>
   </ul>
  </p>
 </div>

</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="function.date-sun-info.html">date_sun_info</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="function.date-sunset.html">date_sunset</a></div>
 <div class="up"><a href="ref.datetime.html">Date/Time Functions</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>