<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/class.intldateformatter.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'it',
  ),
  'this' => 
  array (
    0 => 'intldateformatter.create.php',
    1 => 'IntlDateFormatter::create',
    2 => 'Create a date formatter',
  ),
  'up' => 
  array (
    0 => 'class.intldateformatter.php',
    1 => 'IntlDateFormatter',
  ),
  'prev' => 
  array (
    0 => 'class.intldateformatter.php',
    1 => 'IntlDateFormatter',
  ),
  'next' => 
  array (
    0 => 'intldateformatter.format.php',
    1 => 'IntlDateFormatter::format',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/intl/dateformatter/create.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="intldateformatter.create" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">IntlDateFormatter::create</h1>
  <h1 class="refname">datefmt_create</h1>
  <h1 class="refname">IntlDateFormatter::__construct</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.3.0, PHP 7, PHP 8, PECL intl &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">IntlDateFormatter::create</span> -- <span class="refname">datefmt_create</span> -- <span class="refname">IntlDateFormatter::__construct</span> &mdash; <span class="dc-title">Create a date formatter</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-intldateformatter.create-description">
  <h3 class="title">Descrizione</h3>
  <p class="para">
   Stile orientato agli oggetti
  </p>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="modifier">static</span> <span class="methodname"><strong>IntlDateFormatter::create</strong></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.string.php" class="type string">string</a></span></span> <code class="parameter">$locale</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">$dateType</code><span class="initializer"> = <strong><code><a href="class.intldateformatter.php#intldateformatter.constants.full">IntlDateFormatter::FULL</a></code></strong></span></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">$timeType</code><span class="initializer"> = <strong><code><a href="class.intldateformatter.php#intldateformatter.constants.full">IntlDateFormatter::FULL</a></code></strong></span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><span class="type"><a href="class.intltimezone.php" class="type IntlTimeZone">IntlTimeZone</a></span>|<span class="type"><a href="class.datetimezone.php" class="type DateTimeZone">DateTimeZone</a></span>|<span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.null.php" class="type null">null</a></span></span> <code class="parameter">$timezone</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="class.intlcalendar.php" class="type IntlCalendar">IntlCalendar</a></span>|<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>|<span class="type"><a href="language.types.null.php" class="type null">null</a></span></span> <code class="parameter">$calendar</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.string.php" class="type string">string</a></span></span> <code class="parameter">$pattern</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.null.php" class="type null">?</a></span><span class="type"><a href="class.intldateformatter.php" class="type IntlDateFormatter">IntlDateFormatter</a></span></span></div>

  <p class="para rdfs-comment">
   Stile orientato agli oggetti (constructor)
  </p>
  <div class="constructorsynopsis dc-description"><span class="modifier">public</span> <span class="methodname"><strong>IntlDateFormatter::__construct</strong></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.string.php" class="type string">string</a></span></span> <code class="parameter">$locale</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">$dateType</code><span class="initializer"> = <strong><code><a href="class.intldateformatter.php#intldateformatter.constants.full">IntlDateFormatter::FULL</a></code></strong></span></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">$timeType</code><span class="initializer"> = <strong><code><a href="class.intldateformatter.php#intldateformatter.constants.full">IntlDateFormatter::FULL</a></code></strong></span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><span class="type"><a href="class.intltimezone.php" class="type IntlTimeZone">IntlTimeZone</a></span>|<span class="type"><a href="class.datetimezone.php" class="type DateTimeZone">DateTimeZone</a></span>|<span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.null.php" class="type null">null</a></span></span> <code class="parameter">$timezone</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="class.intlcalendar.php" class="type IntlCalendar">IntlCalendar</a></span>|<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>|<span class="type"><a href="language.types.null.php" class="type null">null</a></span></span> <code class="parameter">$calendar</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.string.php" class="type string">string</a></span></span> <code class="parameter">$pattern</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span><br>)</div>

  <p class="para rdfs-comment">
   Stile procedurale
  </p>
  <div class="methodsynopsis dc-description"><span class="methodname"><strong>datefmt_create</strong></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.string.php" class="type string">string</a></span></span> <code class="parameter">$locale</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">$dateType</code><span class="initializer"> = <strong><code><a href="class.intldateformatter.php#intldateformatter.constants.full">IntlDateFormatter::FULL</a></code></strong></span></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">$timeType</code><span class="initializer"> = <strong><code><a href="class.intldateformatter.php#intldateformatter.constants.full">IntlDateFormatter::FULL</a></code></strong></span></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><span class="type"><a href="class.intltimezone.php" class="type IntlTimeZone">IntlTimeZone</a></span>|<span class="type"><a href="class.datetimezone.php" class="type DateTimeZone">DateTimeZone</a></span>|<span class="type"><a href="language.types.string.php" class="type string">string</a></span>|<span class="type"><a href="language.types.null.php" class="type null">null</a></span></span> <code class="parameter">$timezone</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="class.intlcalendar.php" class="type IntlCalendar">IntlCalendar</a></span>|<span class="type"><a href="language.types.integer.php" class="type int">int</a></span>|<span class="type"><a href="language.types.null.php" class="type null">null</a></span></span> <code class="parameter">$calendar</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.string.php" class="type string">string</a></span></span> <code class="parameter">$pattern</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.null.php" class="type null">?</a></span><span class="type"><a href="class.intldateformatter.php" class="type IntlDateFormatter">IntlDateFormatter</a></span></span></div>

  <p class="para rdfs-comment">
   Create a date formatter.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-intldateformatter.create-parameters">
  <h3 class="title">Elenco dei parametri</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">locale</code></dt>
     <dd>
      <p class="para">
       Locale to use when formatting or parsing or <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> to use the value
       specified in the ini setting <a href="intl.configuration.php#ini.intl.default-locale" class="link">intl.default_locale</a>.
      </p>
     </dd>
    
    
     <dt><code class="parameter">dateType</code></dt>
     <dd>
      <p class="para">
       Format of the date determined by one of the
       <a href="class.intldateformatter.php#intl.intldateformatter-constants" class="link">IntlDateFormatter
       constants</a>. The default value is
       <strong><code><a href="class.intldateformatter.php#intldateformatter.constants.full">IntlDateFormatter::FULL</a></code></strong>.
      </p>
     </dd>
    
    
     <dt><code class="parameter">timeType</code></dt>
     <dd>
      <p class="para">
       Format of the time determined by one of the
       <a href="class.intldateformatter.php#intl.intldateformatter-constants" class="link">IntlDateFormatter
       constants</a>. The default value is
       <strong><code><a href="class.intldateformatter.php#intldateformatter.constants.full">IntlDateFormatter::FULL</a></code></strong>.
      </p>
     </dd>
    
    
     <dt><code class="parameter">timezone</code></dt>
     <dd>
      <p class="para">
       Time zone ID. The default (and the one used if <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> is given) is the
       one returned by <span class="function"><a href="function.date-default-timezone-get.php" class="function">date_default_timezone_get()</a></span> or, if
       applicable, that of the <span class="classname"><a href="class.intlcalendar.php" class="classname">IntlCalendar</a></span> object passed
       for the <code class="parameter">calendar</code> parameter. This ID must be a
       valid identifier on ICUʼs database or an ID representing an
       explicit offset, such as <code class="literal">GMT-05:30</code>.
      </p>
      <p class="para">
       This can also be an <span class="classname"><a href="class.intltimezone.php" class="classname">IntlTimeZone</a></span> or a
       <span class="classname"><a href="class.datetimezone.php" class="classname">DateTimeZone</a></span> object.
      </p>
     </dd>
    
    
     <dt><code class="parameter">calendar</code></dt>
     <dd>
      <p class="para">
       Calendar to use for formatting or parsing. The default value is <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong>,
       which corresponds to <strong><code><a href="class.intldateformatter.php#intldateformatter.constants.gregorian">IntlDateFormatter::GREGORIAN</a></code></strong>.
       This can either be one of the
       <a href="class.intldateformatter.php#intl.intldateformatter-constants.calendartypes" class="link">IntlDateFormatter
       calendar constants</a> or an <span class="classname"><a href="class.intlcalendar.php" class="classname">IntlCalendar</a></span>. Any
       <span class="classname"><a href="class.intlcalendar.php" class="classname">IntlCalendar</a></span> object passed will be clone; it will
       not be changed by the <span class="classname"><a href="class.intldateformatter.php" class="classname">IntlDateFormatter</a></span>. This will
       determine the calendar type used (gregorian, islamic, persian, etc.) and,
       if <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> is given for the <code class="parameter">timezone</code> parameter,
       also the timezone used.
      </p>
     </dd>
    
    
     <dt><code class="parameter">pattern</code></dt>
     <dd>
      <p class="para">
       Optional pattern to use when formatting or parsing.
       Possible patterns are documented at <a href="https://unicode-org.github.io/icu/userguide/format_parse/datetime/" class="link external">&raquo;&nbsp;https://unicode-org.github.io/icu/userguide/format_parse/datetime/</a>.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>



 <div class="refsect1 returnvalues" id="refsect1-intldateformatter.create-returnvalues">
  <h3 class="title">Valori restituiti</h3>
  <p class="para">
   The created <span class="classname"><a href="class.intldateformatter.php" class="classname">IntlDateFormatter</a></span> or <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong> in case of
   failure.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-intldateformatter.create-errors">
  <h3 class="title">Errori/Eccezioni</h3>
  <p class="simpara">
   A <span class="exceptionname"><a href="class.valueerror.php" class="exceptionname">ValueError</a></span> is thrown if
   <code class="parameter">locale</code> is invalid.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-intldateformatter.create-changelog">
  <h3 class="title">Log delle modifiche</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>Versione</th>
       <th>Descrizione</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>8.4.0</td>
       <td>
        <span class="simpara">
         A <span class="exceptionname"><a href="class.valueerror.php" class="exceptionname">ValueError</a></span> is thrown if
         <code class="parameter">locale</code> is invalid.
        </span>
       </td>
      </tr>

      <tr>
       <td>8.1.0</td>
       <td>
        <p class="para">
         Parameters <code class="parameter">dateType</code> and
         <code class="parameter">timeType</code> are now optional.
        </p>
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-intldateformatter.create-examples">
  <h3 class="title">Esempi</h3>
  <div class="example" id="example-1">
   <p><strong>Example #1 <span class="function"><strong>datefmt_create()</strong></span> example</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$fmt </span><span style="color: #007700">= </span><span style="color: #0000BB">datefmt_create</span><span style="color: #007700">( </span><span style="color: #DD0000">"en_US" </span><span style="color: #007700">,</span><span style="color: #0000BB">IntlDateFormatter</span><span style="color: #007700">::</span><span style="color: #0000BB">FULL</span><span style="color: #007700">, </span><span style="color: #0000BB">IntlDateFormatter</span><span style="color: #007700">::</span><span style="color: #0000BB">FULL</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'America/Los_Angeles'</span><span style="color: #007700">, </span><span style="color: #0000BB">IntlDateFormatter</span><span style="color: #007700">::</span><span style="color: #0000BB">GREGORIAN  </span><span style="color: #007700">);<br />echo </span><span style="color: #DD0000">"First Formatted output is "</span><span style="color: #007700">.</span><span style="color: #0000BB">datefmt_format</span><span style="color: #007700">( </span><span style="color: #0000BB">$fmt </span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$fmt </span><span style="color: #007700">= </span><span style="color: #0000BB">datefmt_create</span><span style="color: #007700">( </span><span style="color: #DD0000">"de-DE" </span><span style="color: #007700">,</span><span style="color: #0000BB">IntlDateFormatter</span><span style="color: #007700">::</span><span style="color: #0000BB">FULL</span><span style="color: #007700">, </span><span style="color: #0000BB">IntlDateFormatter</span><span style="color: #007700">::</span><span style="color: #0000BB">FULL</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'America/Los_Angeles'</span><span style="color: #007700">,</span><span style="color: #0000BB">IntlDateFormatter</span><span style="color: #007700">::</span><span style="color: #0000BB">GREGORIAN  </span><span style="color: #007700">);<br />echo </span><span style="color: #DD0000">"Second Formatted output is "</span><span style="color: #007700">.</span><span style="color: #0000BB">datefmt_format</span><span style="color: #007700">( </span><span style="color: #0000BB">$fmt </span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$fmt </span><span style="color: #007700">= </span><span style="color: #0000BB">datefmt_create</span><span style="color: #007700">( </span><span style="color: #DD0000">"en_US" </span><span style="color: #007700">,</span><span style="color: #0000BB">IntlDateFormatter</span><span style="color: #007700">::</span><span style="color: #0000BB">FULL</span><span style="color: #007700">, </span><span style="color: #0000BB">IntlDateFormatter</span><span style="color: #007700">::</span><span style="color: #0000BB">FULL</span><span style="color: #007700">,<br />     </span><span style="color: #DD0000">'America/Los_Angeles'</span><span style="color: #007700">,</span><span style="color: #0000BB">IntlDateFormatter</span><span style="color: #007700">::</span><span style="color: #0000BB">GREGORIAN  </span><span style="color: #007700">,</span><span style="color: #DD0000">"MM/dd/yyyy"</span><span style="color: #007700">);<br />echo </span><span style="color: #DD0000">"First Formatted output with pattern is "</span><span style="color: #007700">.</span><span style="color: #0000BB">datefmt_format</span><span style="color: #007700">( </span><span style="color: #0000BB">$fmt </span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$fmt </span><span style="color: #007700">= </span><span style="color: #0000BB">datefmt_create</span><span style="color: #007700">( </span><span style="color: #DD0000">"de-DE" </span><span style="color: #007700">,</span><span style="color: #0000BB">IntlDateFormatter</span><span style="color: #007700">::</span><span style="color: #0000BB">FULL</span><span style="color: #007700">, </span><span style="color: #0000BB">IntlDateFormatter</span><span style="color: #007700">::</span><span style="color: #0000BB">FULL</span><span style="color: #007700">,<br />     </span><span style="color: #DD0000">'America/Los_Angeles'</span><span style="color: #007700">,</span><span style="color: #0000BB">IntlDateFormatter</span><span style="color: #007700">::</span><span style="color: #0000BB">GREGORIAN  </span><span style="color: #007700">,</span><span style="color: #DD0000">"MM/dd/yyyy"</span><span style="color: #007700">);<br />echo </span><span style="color: #DD0000">"Second Formatted output with pattern is "</span><span style="color: #007700">.</span><span style="color: #0000BB">datefmt_format</span><span style="color: #007700">( </span><span style="color: #0000BB">$fmt </span><span style="color: #007700">, </span><span style="color: #0000BB">0</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

  </div>
  <div class="example" id="example-2">
   <p><strong>Example #2 OO example</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$fmt </span><span style="color: #007700">= new </span><span style="color: #0000BB">IntlDateFormatter</span><span style="color: #007700">( </span><span style="color: #DD0000">"en_US" </span><span style="color: #007700">,</span><span style="color: #0000BB">IntlDateFormatter</span><span style="color: #007700">::</span><span style="color: #0000BB">FULL</span><span style="color: #007700">, </span><span style="color: #0000BB">IntlDateFormatter</span><span style="color: #007700">::</span><span style="color: #0000BB">FULL</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'America/Los_Angeles'</span><span style="color: #007700">,</span><span style="color: #0000BB">IntlDateFormatter</span><span style="color: #007700">::</span><span style="color: #0000BB">GREGORIAN  </span><span style="color: #007700">);<br />echo </span><span style="color: #DD0000">"First Formatted output is "</span><span style="color: #007700">.</span><span style="color: #0000BB">$fmt</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">format</span><span style="color: #007700">(</span><span style="color: #0000BB">0</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$fmt </span><span style="color: #007700">= new </span><span style="color: #0000BB">IntlDateFormatter</span><span style="color: #007700">( </span><span style="color: #DD0000">"de-DE" </span><span style="color: #007700">,</span><span style="color: #0000BB">IntlDateFormatter</span><span style="color: #007700">::</span><span style="color: #0000BB">FULL</span><span style="color: #007700">, </span><span style="color: #0000BB">IntlDateFormatter</span><span style="color: #007700">::</span><span style="color: #0000BB">FULL</span><span style="color: #007700">,<br />    </span><span style="color: #DD0000">'America/Los_Angeles'</span><span style="color: #007700">,</span><span style="color: #0000BB">IntlDateFormatter</span><span style="color: #007700">::</span><span style="color: #0000BB">GREGORIAN  </span><span style="color: #007700">);<br />echo </span><span style="color: #DD0000">"Second Formatted output is "</span><span style="color: #007700">.</span><span style="color: #0000BB">$fmt</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">format</span><span style="color: #007700">(</span><span style="color: #0000BB">0</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$fmt </span><span style="color: #007700">= new </span><span style="color: #0000BB">IntlDateFormatter</span><span style="color: #007700">( </span><span style="color: #DD0000">"en_US" </span><span style="color: #007700">,</span><span style="color: #0000BB">IntlDateFormatter</span><span style="color: #007700">::</span><span style="color: #0000BB">FULL</span><span style="color: #007700">, </span><span style="color: #0000BB">IntlDateFormatter</span><span style="color: #007700">::</span><span style="color: #0000BB">FULL</span><span style="color: #007700">,<br />     </span><span style="color: #DD0000">'America/Los_Angeles'</span><span style="color: #007700">,</span><span style="color: #0000BB">IntlDateFormatter</span><span style="color: #007700">::</span><span style="color: #0000BB">GREGORIAN  </span><span style="color: #007700">,</span><span style="color: #DD0000">"MM/dd/yyyy"</span><span style="color: #007700">);<br />echo </span><span style="color: #DD0000">"First Formatted output with pattern is "</span><span style="color: #007700">.</span><span style="color: #0000BB">$fmt</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">format</span><span style="color: #007700">(</span><span style="color: #0000BB">0</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$fmt </span><span style="color: #007700">= new </span><span style="color: #0000BB">IntlDateFormatter</span><span style="color: #007700">( </span><span style="color: #DD0000">"de-DE" </span><span style="color: #007700">,</span><span style="color: #0000BB">IntlDateFormatter</span><span style="color: #007700">::</span><span style="color: #0000BB">FULL</span><span style="color: #007700">, </span><span style="color: #0000BB">IntlDateFormatter</span><span style="color: #007700">::</span><span style="color: #0000BB">FULL</span><span style="color: #007700">,<br />      </span><span style="color: #DD0000">'America/Los_Angeles'</span><span style="color: #007700">,</span><span style="color: #0000BB">IntlDateFormatter</span><span style="color: #007700">::</span><span style="color: #0000BB">GREGORIAN </span><span style="color: #007700">, </span><span style="color: #DD0000">"MM/dd/yyyy"</span><span style="color: #007700">);<br />echo </span><span style="color: #DD0000">"Second Formatted output with pattern is "</span><span style="color: #007700">.</span><span style="color: #0000BB">$fmt</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">format</span><span style="color: #007700">(</span><span style="color: #0000BB">0</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
   </div>

  </div>
   <div class="example" id="example-3">
    <p><strong>Example #3 Example of invalid locale handling</strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">try {<br />    </span><span style="color: #0000BB">$fmt </span><span style="color: #007700">= new </span><span style="color: #0000BB">IntlDateFormatter</span><span style="color: #007700">(<br />        </span><span style="color: #DD0000">'invalid_locale'</span><span style="color: #007700">,<br />        </span><span style="color: #0000BB">IntlDateFormatter</span><span style="color: #007700">::</span><span style="color: #0000BB">FULL</span><span style="color: #007700">,<br />        </span><span style="color: #0000BB">IntlDateFormatter</span><span style="color: #007700">::</span><span style="color: #0000BB">FULL</span><span style="color: #007700">,<br />        </span><span style="color: #DD0000">'dunno'</span><span style="color: #007700">,<br />        </span><span style="color: #0000BB">IntlDateFormatter</span><span style="color: #007700">::</span><span style="color: #0000BB">GREGORIAN</span><span style="color: #007700">,<br />    );<br />} catch (</span><span style="color: #0000BB">\Error $e</span><span style="color: #007700">) {<br />    </span><span style="color: #FF8000">// ...<br /></span><span style="color: #007700">}<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

   </div>
  <p class="para">Il precedente esempio visualizzerà:</p>
  <div class="example-contents screen">
<div class="examplescode"><pre class="examplescode">First Formatted output is Wednesday, December 31, 1969 4:00:00 PM PT
Second Formatted output is Mittwoch, 31. Dezember 1969 16:00 Uhr GMT-08:00
First Formatted output with pattern is 12/31/1969
Second Formatted output with pattern is 12/31/1969</pre>
</div>
  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-intldateformatter.create-seealso">
  <h3 class="title">Vedere anche:</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="intldateformatter.format.php" class="function" rel="rdfs-seeAlso">datefmt_format()</a> - Format the date/time value as a string</span></li>
    <li><span class="function"><a href="intldateformatter.parse.php" class="function" rel="rdfs-seeAlso">datefmt_parse()</a> - Parse string to a timestamp value</span></li>
    <li><span class="function"><a href="intldateformatter.geterrorcode.php" class="function" rel="rdfs-seeAlso">datefmt_get_error_code()</a> - Get the error code from last operation</span></li>
    <li><span class="function"><a href="intldateformatter.geterrormessage.php" class="function" rel="rdfs-seeAlso">datefmt_get_error_message()</a> - Get the error text from the last operation</span></li>
   </ul>
  </p>
 </div>

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