downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Our source is open

The syntax highlighted source is automatically generated by PHP from the plaintext script. If you're interested in what's behind the several functions we used, you can always take a look at the source of the following files:

Of course, if you want to see the source of this page, we have it available. You can also browse the SVN repository for this website on svn.php.net.

Source of: /manual/en/function.date-sun-info.php

<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = 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 => 'en',
  ),
 
'this' =>
  array (
   
0 => 'function.date-sun-info.php',
   
1 => 'date_sun_info',
  ),
 
'up' =>
  array (
   
0 => 'ref.datetime.php',
   
1 => 'Date/Time Functions',
  ),
 
'prev' =>
  array (
   
0 => 'function.date-sub.php',
   
1 => 'date_sub',
  ),
 
'next' =>
  array (
   
0 => 'function.date-sunrise.php',
   
1 => 'date_sunrise',
  ),
);
$setup["toc"] = $TOC;
$setup["parents"] = $PARENTS;
manual_setup($setup);

manual_header();
?>
<div id="function.date-sun-info" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">date_sun_info</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.1.2)</p><p class="refpurpose"><span class="refname">date_sun_info</span> &mdash; <span class="dc-title">Returns an array with information about sunset/sunrise and twilight begin/end</span></p>

 </div>
 <a name="function.date-sun-info.description"></a><div class="refsect1 description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="type">array</span> <span class="methodname"><b>date_sun_info</b></span>
    ( <span class="methodparam"><span class="type">int</span> <tt class="parameter">$time</tt></span>
   , <span class="methodparam"><span class="type">float</span> <tt class="parameter">$latitude</tt></span>
   , <span class="methodparam"><span class="type">float</span> <tt class="parameter">$longitude</tt></span>
   )</div>

 </div>


 <a name="function.date-sun-info.parameters"></a><div class="refsect1 parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">
   </p><dl>

    <dt class="varlistentry">

     <span class="term"><i><tt class="parameter">time</tt></i>
</span>

     </dt><dd class="listitem">

      <p class="para">
       Timestamp.
      </p>
     </dd>

   
    <dt class="varlistentry">

     <span class="term"><i><tt class="parameter">latitude</tt></i>
</span>

     </dt><dd class="listitem">

      <p class="para">
       Latitude in degrees.
      </p>
     </dd>

   
    <dt class="varlistentry">

     <span class="term"><i><tt class="parameter">longitude</tt></i>
</span>

     </dt><dd class="listitem">

      <p class="para">
       Longitude in degrees.
      </p>
     </dd>

   
   </dl>
<p>
  </p>
 </div>


 <a name="function.date-sun-info.returnvalues"></a><div class="refsect1 returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns array on success or <b><tt class="constant">FALSE</tt></b> on failure.
  </p>
 </div>


 <a name="function.date-sun-info.examples"></a><div class="refsect1 examples">
  <h3 class="title">Examples</h3>
  <p class="para">
   </p><div class="example">
    <p><b>Example #1 A <b>date_sun_info()</b> example</b></p>
    <div class="example-contents programlisting">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$sun_info&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">date_sun_info</span><span style="color: #007700">(</span><span style="color: #0000BB">strtotime</span><span style="color: #007700">(</span><span style="color: #DD0000">"2006-12-12"</span><span style="color: #007700">),&nbsp;</span><span style="color: #0000BB">31.7667</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">35.2333</span><span style="color: #007700">);<br />foreach&nbsp;(</span><span style="color: #0000BB">$sun_info&nbsp;</span><span style="color: #007700">as&nbsp;</span><span style="color: #0000BB">$key&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">$val</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"</span><span style="color: #0000BB">$key</span><span style="color: #DD0000">:&nbsp;"&nbsp;</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">date</span><span style="color: #007700">(</span><span style="color: #DD0000">"H:i:s"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$val</span><span style="color: #007700">)&nbsp;.&nbsp;</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
    </div>

    <div class="example-contents para"><p>The above example will output:</p></div>
    <div class="example-contents screen">
<div class="cdata"><pre>
sunrise: 05:52:11
sunset: 15:41:21
transit: 10:46:46
civil_twilight_begin: 05:24:08
civil_twilight_end: 16:09:24
nautical_twilight_begin: 04:52:25
nautical_twilight_end: 16:41:06
astronomical_twilight_begin: 04:21:32
astronomical_twilight_end: 17:12:00
</pre></div>
    </div>
   </div><p>
  </p>
 </div>


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


</div><?php manual_footer(); ?>
 
show source | credits | sitemap | contact | advertising | mirror sites