<?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-default-timezone-get.php',
    1 => 'date_default_timezone_get',
    2 => 'Recupera el huso horario por defecto utilizado por todas las funciones de fecha/hora de un script',
  ),
  'up' => 
  array (
    0 => 'ref.datetime.php',
    1 => 'Funciones de Fecha/Hora',
  ),
  'prev' => 
  array (
    0 => 'function.date-date-set.php',
    1 => 'date_date_set',
  ),
  'next' => 
  array (
    0 => 'function.date-default-timezone-set.php',
    1 => 'date_default_timezone_set',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'es',
    'path' => 'reference/datetime/functions/date-default-timezone-get.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.date-default-timezone-get" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">date_default_timezone_get</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.1.0, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">date_default_timezone_get</span> &mdash; <span class="dc-title">
   Recupera el huso horario por defecto utilizado por todas las funciones de fecha/hora de un script
  </span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.date-default-timezone-get-description">
  <h3 class="title">Descripción</h3>
  <div class="methodsynopsis dc-description"><span class="methodname"><strong>date_default_timezone_get</strong></span>(): <span class="type"><a href="language.types.string.php" class="type string">string</a></span></div>

  <p class="para rdfs-comment">
   Esta función devuelve el huso horario siguiendo el siguiente orden de preferencia:
   <ul class="itemizedlist">
    <li class="listitem">
     <p class="para">
      Lectura del huso horario definido utilizando la función
      <span class="function"><a href="function.date-default-timezone-set.php" class="function">date_default_timezone_set()</a></span> (si existe)
     </p>
    </li>
    <li class="listitem">
     <p class="para">
      Lectura del valor de la opción de configuración
      <a href="datetime.configuration.php#ini.date.timezone" class="link">date.timezone</a>
      (si está definida)
     </p>
    </li>
   </ul>
  </p>
  <p class="para">
   Si todo lo anterior falla, <span class="methodname"><strong>date_default_timezone_get()</strong></span>
   devolverá el huso horario por defecto de <code class="literal">UTC</code>.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.date-default-timezone-get-parameters">
  <h3 class="title">Parámetros</h3>
  <p class="para">Esta función no contiene ningún parámetro.</p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.date-default-timezone-get-returnvalues">
  <h3 class="title">Valores devueltos</h3>
  <p class="para">
   Devuelve un <span class="type"><a href="language.types.string.php" class="type string">string</a></span>.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.date-default-timezone-get-examples">
  <h3 class="title">Ejemplos</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Ejemplo #1 Recuperación del huso horario por defecto</strong></p>
    <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />date_default_timezone_set</span><span style="color: #007700">(</span><span style="color: #DD0000">'Europe/London'</span><span style="color: #007700">);<br /><br />if (</span><span style="color: #0000BB">date_default_timezone_get</span><span style="color: #007700">()) {<br />    echo </span><span style="color: #DD0000">'date_default_timezone_set: ' </span><span style="color: #007700">. </span><span style="color: #0000BB">date_default_timezone_get</span><span style="color: #007700">() . </span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br />}<br /><br />if (</span><span style="color: #0000BB">ini_get</span><span style="color: #007700">(</span><span style="color: #DD0000">'date.timezone'</span><span style="color: #007700">)) {<br />    echo </span><span style="color: #DD0000">'date.timezone : ' </span><span style="color: #007700">. </span><span style="color: #0000BB">ini_get</span><span style="color: #007700">(</span><span style="color: #DD0000">'date.timezone'</span><span style="color: #007700">);<br />}</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">date_default_timezone_set : Europe/London
date.timezone : Europe/London</pre>
</div>
    </div>
   </div>
  </p>
  <p class="para">
   <div class="example" id="example-2">
    <p><strong>Ejemplo #2 Recuperación de la abreviatura de un huso horario</strong></p>
    <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />date_default_timezone_set</span><span style="color: #007700">(</span><span style="color: #DD0000">'America/Los_Angeles'</span><span style="color: #007700">);<br />echo </span><span style="color: #0000BB">date_default_timezone_get</span><span style="color: #007700">() . </span><span style="color: #DD0000">' =&gt; ' </span><span style="color: #007700">. </span><span style="color: #0000BB">date</span><span style="color: #007700">(</span><span style="color: #DD0000">'e'</span><span style="color: #007700">) . </span><span style="color: #DD0000">' =&gt; ' </span><span style="color: #007700">. </span><span style="color: #0000BB">date</span><span style="color: #007700">(</span><span style="color: #DD0000">'T'</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">America/Los_Angeles =&gt; America/Los_Angeles =&gt; PST</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.date-default-timezone-get-seealso">
  <h3 class="title">Ver también</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.date-default-timezone-set.php" class="function" rel="rdfs-seeAlso">date_default_timezone_set()</a> - Establece la zona horaria por defecto para todas las funciones de fecha/hora</span></li>
    <li><a href="timezones.php" class="xref">Lista de Zonas Horarias Soportadas</a></li>
   </ul>
  </p>
 </div>

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