<?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 => 'it',
  ),
  'this' => 
  array (
    0 => 'function.date-default-timezone-set.php',
    1 => 'date_default_timezone_set',
    2 => 'Sets the default timezone used by all date/time functions in a script',
  ),
  'up' => 
  array (
    0 => 'ref.datetime.php',
    1 => 'Date/Time Funzioni',
  ),
  'prev' => 
  array (
    0 => 'function.date-default-timezone-get.php',
    1 => 'date_default_timezone_get',
  ),
  'next' => 
  array (
    0 => 'function.date-diff.php',
    1 => 'date_diff',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/datetime/functions/date-default-timezone-set.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-set" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">date_default_timezone_set</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.1.0, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">date_default_timezone_set</span> &mdash; <span class="dc-title">
   Sets the default timezone used by all date/time functions in a script
  </span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.date-default-timezone-set-description">
  <h3 class="title">Descrizione</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>date_default_timezone_set</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$timezoneId</code></span>): <span class="type"><a href="language.types.boolean.php" class="type bool">bool</a></span></div>

  <p class="para rdfs-comment">
   <span class="function"><strong>date_default_timezone_set()</strong></span> sets the default timezone
   used by all date/time functions.
  </p>
  <p class="para">
   Instead of using this function to set the default timezone in your script,
   you can also use the INI setting <a href="datetime.configuration.php#ini.date.timezone" class="link">date.timezone</a> to set the default
   timezone.
  </p>
 </div>

 
 <div class="refsect1 parameters" id="refsect1-function.date-default-timezone-set-parameters">
  <h3 class="title">Elenco dei parametri</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">timezoneId</code></dt>
     <dd>
      <p class="para">
       The timezone identifier, like <code class="literal">UTC</code>,
       <code class="literal">Africa/Lagos</code>, <code class="literal">Asia/Hong_Kong</code>, or
       <code class="literal">Europe/Lisbon</code>. The list of valid identifiers is
       available in the <a href="timezones.php" class="xref">elenco delle Timezone supportate</a>.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.date-default-timezone-set-returnvalues">
  <h3 class="title">Valori restituiti</h3>
  <p class="para">
   This function returns <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> if the
   <code class="parameter">timezoneId</code> isn&#039;t valid, or <strong><code><a href="reserved.constants.php#constant.true">true</a></code></strong>
   otherwise.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.date-default-timezone-set-examples">
  <h3 class="title">Esempi</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Example #1 Getting the default timezone</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 /><br /></span><span style="color: #0000BB">$script_tz </span><span style="color: #007700">= </span><span style="color: #0000BB">date_default_timezone_get</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$ini_tz </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 /><br />if (</span><span style="color: #0000BB">strcmp</span><span style="color: #007700">(</span><span style="color: #0000BB">$script_tz</span><span style="color: #007700">, </span><span style="color: #0000BB">$ini_tz</span><span style="color: #007700">)){<br />    echo </span><span style="color: #DD0000">'Script timezone differs from ini-set timezone.'</span><span style="color: #007700">;<br />} else {<br />    echo </span><span style="color: #DD0000">'Script timezone and ini-set timezone match.'</span><span style="color: #007700">;<br />}</span></span></code></div>
    </div>

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


 <div class="refsect1 seealso" id="refsect1-function.date-default-timezone-set-seealso">
  <h3 class="title">Vedere anche:</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.date-default-timezone-get.php" class="function" rel="rdfs-seeAlso">date_default_timezone_get()</a> - Gets the default timezone used by all date/time functions in a script</span></li>
    <li><a href="timezones.php" class="xref">elenco delle Timezone supportate</a></li>
   </ul>
  </p>
 </div>

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