<?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.strptime.php',
    1 => 'strptime',
    2 => 'Parse a time/date generated with strftime',
  ),
  'up' => 
  array (
    0 => 'ref.datetime.php',
    1 => 'Date/Time Funzioni',
  ),
  'prev' => 
  array (
    0 => 'function.strftime.php',
    1 => 'strftime',
  ),
  'next' => 
  array (
    0 => 'function.strtotime.php',
    1 => 'strtotime',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/datetime/functions/strptime.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.strptime" class="refentry">
   <div class="refnamediv">
    <h1 class="refname">strptime</h1>
    <p class="verinfo">(PHP 5 &gt;= 5.1.0, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">strptime</span> &mdash; <span class="dc-title">
     Parse a time/date generated with <span class="function"><a href="function.strftime.php" class="function">strftime()</a></span>
    </span></p>

   </div>

 <div id="function.strptime-refsynopsisdiv">
  <div class="warning"><strong class="warning">Avviso</strong><p class="simpara">This function has been
<em>DEPRECATED</em> as of PHP 8.1.0. Relying on this function
is highly discouraged.</p></div>
 </div>
 
   <div class="refsect1 description" id="refsect1-function.strptime-description">
    <h3 class="title">Descrizione</h3>
    <div class="methodsynopsis dc-description">
   <span class="attribute"><a href="class.deprecated.php">#[\Deprecated]</a> </span><br>
   <span class="methodname"><strong>strptime</strong></span>(<span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$timestamp</code></span>, <span class="methodparam"><span class="type"><a href="language.types.string.php" class="type string">string</a></span> <code class="parameter">$format</code></span>): <span class="type"><span class="type"><a href="language.types.array.php" class="type array">array</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>strptime()</strong></span> returns an array with the
     <code class="parameter">timestamp</code> parsed, or <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> on error.
    </p>
    <p class="para">
     Month and weekday names and other language dependent strings respect the
     current locale set with <span class="function"><a href="function.setlocale.php" class="function">setlocale()</a></span> (<strong><code><a href="string.constants.php#constant.lc-time">LC_TIME</a></code></strong>).
    </p>
   </div>


   <div class="refsect1 parameters" id="refsect1-function.strptime-parameters">
   <h3 class="title">Elenco dei parametri</h3>
   <p class="para">
    <dl>
     
      <dt><code class="parameter">timestamp</code> (<span class="type"><a href="language.types.string.php" class="type string">string</a></span>)</dt>
      <dd>
       <p class="para">
        The string to parse (e.g. returned from <span class="function"><a href="function.strftime.php" class="function">strftime()</a></span>).
       </p>
      </dd>
     
     
      <dt><code class="parameter">format</code> (<span class="type"><a href="language.types.string.php" class="type string">string</a></span>)</dt>
      <dd>
       <p class="para">
        The format used in <code class="parameter">timestamp</code> (e.g. the same as
        used in <span class="function"><a href="function.strftime.php" class="function">strftime()</a></span>). Note that some of the format
        options available to <span class="function"><a href="function.strftime.php" class="function">strftime()</a></span> may not have any
        effect within <span class="function"><strong>strptime()</strong></span>; the exact subset that are
        supported will vary based on the operating system and C library in
        use.
       </p>
       <p class="para">
        For more information about the format options, read the
        <span class="function"><a href="function.strftime.php" class="function">strftime()</a></span> page.
       </p>
      </dd>
     
    </dl>
   </p>
  </div>


  <div class="refsect1 returnvalues" id="refsect1-function.strptime-returnvalues">
   <h3 class="title">Valori restituiti</h3>
   <p class="para">
    Returns an array o <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> in caso di fallimento.
   </p>

    <p class="para">
     <table class="doctable table">
      <caption><strong>The following parameters are returned in the array</strong></caption>
      
       <thead>
        <tr>
         <th>parameters</th>
         <th>Description</th>
        </tr>

       </thead>

       <tbody class="tbody">
        <tr>
         <td><code class="literal">&quot;tm_sec&quot;</code></td>
         <td>Seconds after the minute (0-61)</td>
        </tr>

        <tr>
         <td><code class="literal">&quot;tm_min&quot;</code></td>
         <td>Minutes after the hour (0-59)</td>
        </tr>

        <tr>
         <td><code class="literal">&quot;tm_hour&quot;</code></td>
         <td>Hour since midnight (0-23)</td>
        </tr>

        <tr>
         <td><code class="literal">&quot;tm_mday&quot;</code></td>
         <td>Day of the month (1-31)</td>
        </tr>

        <tr>
         <td><code class="literal">&quot;tm_mon&quot;</code></td>
         <td>Months since January (0-11)</td>
        </tr>

        <tr>
         <td><code class="literal">&quot;tm_year&quot;</code></td>
         <td>Years since 1900</td>
        </tr>

        <tr>
         <td><code class="literal">&quot;tm_wday&quot;</code></td>
         <td>Days since Sunday (0-6)</td>
        </tr>

        <tr>
         <td><code class="literal">&quot;tm_yday&quot;</code></td>
         <td>Days since January 1 (0-365)</td>
        </tr>

        <tr>
         <td><code class="literal">&quot;unparsed&quot;</code></td>
         <td>the <code class="parameter">timestamp</code> part which was not
          recognized using the specified <code class="parameter">format</code></td>
        </tr>

       </tbody>
      
     </table>

    </p>

  </div>


 <div class="refsect1 changelog" id="refsect1-function.strptime-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.1.0</td>
       <td>
        This function has been deprecated.
        Use <span class="function"><a href="function.date-parse-from-format.php" class="function">date_parse_from_format()</a></span> instead (for locale-independent parsing),
        or <span class="methodname"><a href="intldateformatter.parse.php" class="methodname">IntlDateFormatter::parse()</a></span> (for locale-dependent parsing)
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-function.strptime-examples">
  <h3 class="title">Esempi</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Example #1 <span class="function"><strong>strptime()</strong></span> example</strong></p>
    <div class="example-contents">
<div class="annotation-interactive phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$format </span><span style="color: #007700">= </span><span style="color: #DD0000">'%d/%m/%Y %H:%M:%S'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$strf </span><span style="color: #007700">= </span><span style="color: #0000BB">strftime</span><span style="color: #007700">(</span><span style="color: #0000BB">$format</span><span style="color: #007700">);<br /><br />echo </span><span style="color: #DD0000">"</span><span style="color: #0000BB">$strf</span><span style="color: #DD0000">\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">print_r</span><span style="color: #007700">(</span><span style="color: #0000BB">strptime</span><span style="color: #007700">(</span><span style="color: #0000BB">$strf</span><span style="color: #007700">, </span><span style="color: #0000BB">$format</span><span style="color: #007700">));</span></span></code></div>
    </div>

    <div class="example-contents"><p>Il precedente esempio visualizzerà
qualcosa simile a:</p></div>
    <div class="example-contents screen">
<div class="annotation-interactive examplescode"><pre class="examplescode">03/10/2004 15:54:19

Array
(
    [tm_sec] =&gt; 19
    [tm_min] =&gt; 54
    [tm_hour] =&gt; 15
    [tm_mday] =&gt; 3
    [tm_mon] =&gt; 9
    [tm_year] =&gt; 104
    [tm_wday] =&gt; 0
    [tm_yday] =&gt; 276
    [unparsed] =&gt;
)</pre>
</div>
    </div>
   </div>
  </p>
 </div>


 <div class="refsect1 notes" id="refsect1-function.strptime-notes">
  <h3 class="title">Note</h3>
  <blockquote class="note"><p><strong class="note">Nota</strong>: <span class="simpara">Questa funzione non è
implementata sulle piattaforme Windows.</span></p></blockquote>
  <blockquote class="note"><p><strong class="note">Nota</strong>: 
   <p class="para">
    Internally, this function calls the <code class="literal">strptime()</code>
    function provided by the system&#039;s C library. This function can exhibit
    noticeably different behaviour across different operating systems. The
    use of <span class="function"><a href="function.date-parse-from-format.php" class="function">date_parse_from_format()</a></span>, which does not
    suffer from these issues, is recommended.
   </p>
  </p></blockquote>
  <blockquote class="note"><p><strong class="note">Nota</strong>: 
   <p class="para">
    <code class="literal">&quot;tm_sec&quot;</code> includes any leap seconds (currently upto 2
    a year). For more information on leap seconds, see the <a href="http://en.wikipedia.org/wiki/Leap_second" class="link external">&raquo;&nbsp;Wikipedia article
    on leap seconds</a>.
   </p>
  </p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.strptime-seealso">
  <h3 class="title">Vedere anche:</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="methodname"><a href="intldateformatter.parse.php" class="methodname" rel="rdfs-seeAlso">IntlDateFormatter::parse()</a> - Parse string to a timestamp value</span></li>
    <li><span class="methodname"><a href="datetime.createfromformat.php" class="methodname" rel="rdfs-seeAlso">DateTime::createFromFormat()</a> - Parses a time string according to a specified format</span></li>
    <li><span class="function"><a href="function.checkdate.php" class="function" rel="rdfs-seeAlso">checkdate()</a> - Valida una data gregoriana</span></li>
    <li><span class="function"><a href="function.strftime.php" class="function" rel="rdfs-seeAlso">strftime()</a> - Formatta una data/orario locale accordandola/o alle impostazioni locali according to locale settings</span></li>
    <li><span class="function"><a href="function.date-parse-from-format.php" class="function" rel="rdfs-seeAlso">date_parse_from_format()</a> - Get info about given date formatted according to the specified format</span></li>
   </ul>
  </p>
 </div>

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