<?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 => 'es',
  ),
  'this' => 
  array (
    0 => 'function.date-sunrise.php',
    1 => 'date_sunrise',
    2 => 'Devuelve la hora de salida del sol para un d&iacute;a y un lugar dados',
  ),
  'up' => 
  array (
    0 => 'ref.datetime.php',
    1 => 'Funciones de Fecha/Hora',
  ),
  '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' => 'es',
    '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">Devuelve la hora de salida del sol para un día y un lugar dados</span></p>

 </div>

 <div id="function.date-sunrise-refsynopsisdiv">
  <div class="warning"><strong class="warning">Advertencia</strong>
   <p class="para">
    Esta función está <em>OBSOLETA</em> a partir de PHP 8.1.0.
    Depender de esta función está altamente desaconsejado. Se recomienda
    el uso de <span class="function"><a href="function.date-sun-info.php" class="function">date_sun_info()</a></span> en su lugar.
   </p>
  </div>
 </div>

 <div class="refsect1 description" id="refsect1-function.date-sunrise-description">
  <h3 class="title">Descripción</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> devuelve la hora de salida del sol para un día
   (especificado por el argumento <code class="parameter">timestamp</code>) y un lugar dados.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.date-sunrise-parameters">
  <h3 class="title">Parámetros</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">timestamp</code></dt>
     <dd>
      <p class="para">
       El timestamp Unix del día para el cual se proporciona la hora de salida del sol.
      </p>
     </dd>
    
    
     <dt><code class="parameter">returnFormat</code></dt>
     <dd>
      <p class="para">
       <table class="doctable table">
        <caption><strong>Constantes para el argumento <code class="parameter">format</code></strong></caption>
        
         <thead>
          <tr>
           <th>Constante</th>
           <th>Descripción</th>
           <th>Ejemplo</th>
          </tr>

         </thead>

         <tbody class="tbody">
          <tr>
           <td>SUNFUNCS_RET_STRING</td>
           <td>Devuelve el resultado como <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>Devuelve el resultado como <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>Devuelve el resultado como <span class="type"><a href="language.types.integer.php" class="type int">int</a></span> (timestamp)</td>
           <td>1095034606</td>
          </tr>

         </tbody>
        
       </table>

      </p>
     </dd>
    
    
     <dt><code class="parameter">latitude</code></dt>
     <dd>
      <p class="para">
       Por defecto, es el Norte. Pase un valor negativo para el Sur.
       Ver también <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">
       Por defecto, es el Este. Pase un valor negativo para el Oeste.
       Ver también <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> es el ángulo entre el centro del
       sol y la línea perpendicular a la superficie de la tierra. Por defecto
       <a href="datetime.configuration.php#ini.date.sunrise-zenith" class="link">date.sunrise_zenith</a>
       <table class="doctable table">
        <caption><strong>Valores comunes del ángulo <code class="parameter">zenith</code></strong></caption>
        
         <thead>
          <tr>
           <th>Ángulo</th>
           <th>Descripción</th>
          </tr>

         </thead>

         <tbody class="tbody">
          <tr>
           <td>90°50&#039;</td>
           <td>Salida del sol: el punto donde el sol se vuelve visible.</td>
          </tr>

          <tr>
           <td>96°</td>
           <td>Crepúsculo civil: convencionalmente utilizado para significar el inicio del amanecer.</td>
          </tr>

          <tr>
           <td>102°</td>
           <td>Crepúsculo náutico: el punto donde el horizonte comienza a ser visible en el mar.</td>
          </tr>

          <tr>
           <td>108°</td>
           <td>Crepúsculo astronómico: el punto donde el sol comienza a ser la fuente de toda iluminación.</td>
          </tr>

         </tbody>
        
       </table>

      </p>
     </dd>
    
    
     <dt><code class="parameter">utcOffset</code></dt>
     <dd>
      <p class="para">
       Especificado en horas.
       El <code class="parameter">utcOffset</code> se ignora si
       <code class="parameter">returnFormat</code> es
       <strong><code><a href="datetime.constants.php#constant.sunfuncs-ret-timestamp">SUNFUNCS_RET_TIMESTAMP</a></code></strong>.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.date-sunrise-returnvalues">
  <h3 class="title">Valores devueltos</h3>
  <p class="para">
   Devuelve la hora de salida del sol en el <code class="parameter">returnFormat</code>
   especificado en caso de éxito o <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> si ocurre un error.
   Una razón posible del fallo es que el sol no salga
   en absoluto, lo cual ocurre dentro de los círculos
   polares durante parte del año.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-function.date-sunrise-errors">
  <h3 class="title">Errores/Excepciones</h3>
  <p class="para">
Cada llamada a una función de fecha/hora generará un diagnóstico de tipo
<strong><code><a href="errorfunc.constants.php#constant.e-warning">E_WARNING</a></code></strong> si la zona horaria no es válida.
Ver también <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">Historial de cambios</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>Versión</th>
       <th>Descripción</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>8.1.0</td>
       <td>
        Esta función ha sido marcada como obsoleta en favor de <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> y <code class="parameter">utcOffset</code> ahora son nullable.
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.date-sunrise-examples">
  <h3 class="title">Ejemplos</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Ejemplo #1 Ejemplo con <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">/* Calcula la hora de salida del sol para Lisboa, Portugal<br />Latitud: 38.4 Norte<br />Longitud: 9 Oeste<br />Zenith ~= 90<br />offset: +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">', hora de salida del sol: ' </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>Resultado del ejemplo anterior es similar a:</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>Ejemplo #2 Sin salida del sol</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>El ejemplo anterior mostrará:</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">Ver también</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> - Retorna un array con las informaciones sobre el amanecer/atardecer
   as&iacute; como el inicio y el fin del amanecer</span></li>
   </ul>
  </p>
 </div>

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