<?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 => 'fr',
  ),
  'this' => 
  array (
    0 => 'function.strptime.php',
    1 => 'strptime',
    2 => 'Analyse une date g&eacute;n&eacute;r&eacute;e par strftime',
  ),
  'up' => 
  array (
    0 => 'ref.datetime.php',
    1 => 'Fonctions Date/Heure',
  ),
  'prev' => 
  array (
    0 => 'function.strftime.php',
    1 => 'strftime',
  ),
  'next' => 
  array (
    0 => 'function.strtotime.php',
    1 => 'strtotime',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'fr',
    '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">
   Analyse une date générée par <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">Avertissement</strong><p class="simpara">
 Cette fonction est <em>OBSOLÈTE</em> à partir de PHP 8.1.0.
 Dépendre de cette fonction est fortement déconseillé.
</p></div>
 </div>

 <div class="refsect1 description" id="refsect1-function.strptime-description">
  <h3 class="title">Description</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> retourne un tableau après avoir
   analysé <code class="parameter">timestamp</code>, ou <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> en cas d&#039;erreur.
  </p>
  <p class="para">
   Les noms des mois et jours de la semaine dépendent de la configuration
   locale, choisie avec <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">Liste de paramètres</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">timestamp</code> (<a href="language.types.string.php" class="link">chaîne de caractères</a>)</dt>
     <dd>
      <p class="para">
       La chaîne à analyser (p. ex. retournée par <span class="function"><a href="function.strftime.php" class="function">strftime()</a></span>)
      </p>
     </dd>
    
    
     <dt><code class="parameter">format</code> (<a href="language.types.string.php" class="link">chaîne de caractères</a>)</dt>
     <dd>
      <p class="para">
       Le format utilisé par <code class="parameter">timestamp</code> (p. ex. le
       même que celui qui a été utilisé par <span class="function"><a href="function.strftime.php" class="function">strftime()</a></span>).
      </p>
      <p class="para">
       Pour plus d&#039;informations sur les spécificateurs de formats, voir
       la fonction <span class="function"><a href="function.strftime.php" class="function">strftime()</a></span>.
      </p>
     </dd>
    
   </dl>
  </p>
 </div>

 
 <div class="refsect1 returnvalues" id="refsect1-function.strptime-returnvalues">
  <h3 class="title">Valeurs de retour</h3>
  <p class="para">
   Retourne un tableau ou <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong> si une erreur survient.
  </p>
  
  <p class="para">
   <table class="doctable table">
    <caption><strong>Les paramètres suivants sont retournés dans le tableau</strong></caption>
    
     <thead>
      <tr>
       <th>Paramètres</th>
       <th>Description</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td><code class="literal">&quot;tm_sec&quot;</code></td>
       <td>Secondes après la minute (0-61)</td>
      </tr>

      <tr>
       <td><code class="literal">&quot;tm_min&quot;</code></td>
       <td>Minutes après l&#039;heure (0-59)</td>
      </tr>

      <tr>
       <td><code class="literal">&quot;tm_hour&quot;</code></td>
       <td>Heure depuis minuit (0-23)</td>
      </tr>

      <tr>
       <td><code class="literal">&quot;tm_mday&quot;</code></td>
       <td>Jour du mois (1-31)</td>
      </tr>

      <tr>
       <td><code class="literal">&quot;tm_mon&quot;</code></td>
       <td>Mois depuis janvier (0-11)</td>
      </tr>

      <tr>
       <td><code class="literal">&quot;tm_year&quot;</code></td>
       <td>Années depuis 1900</td>
      </tr>

      <tr>
       <td><code class="literal">&quot;tm_wday&quot;</code></td>
       <td>Jours depuis dimanche (0-6)</td>
      </tr>

      <tr>
       <td><code class="literal">&quot;tm_yday&quot;</code></td>
       <td>Jours depuis le 1er janvier (0-365)</td>
      </tr>

      <tr>
       <td><code class="literal">&quot;unparsed&quot;</code></td>
       <td>
        La partie de <code class="parameter">timestamp</code> qui n&#039;a pas été
        reconnue par l&#039;analyseur avec le <code class="parameter">format</code>
        spécifié.
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.strptime-changelog">
  <h3 class="title">Historique</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>Version</th>
       <th>Description</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>8.1.0</td>
       <td>
        Cette fonction a été rendue obsolète.
        Utiliser <span class="function"><a href="function.date-parse-from-format.php" class="function">date_parse_from_format()</a></span> à la place (pour de l&#039;analyse indépendante de la locale),
        ou <span class="methodname"><a href="intldateformatter.parse.php" class="methodname">IntlDateFormatter::parse()</a></span> (pour de l&#039;analyse dépendante de la locale)
       </td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>

 
 <div class="refsect1 examples" id="refsect1-function.strptime-examples">
  <h3 class="title">Exemples</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>Exemple #1 Exemple avec <span class="function"><strong>strptime()</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 />$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>Résultat de l&#039;exemple ci-dessus est similaire à :</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">Notes</h3>
  <blockquote class="note"><p><strong class="note">Note</strong>: <span class="simpara">
 Cette fonction n&#039;est pas implémentée sur les plates-formes Windows.
</span></p></blockquote>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    En interne, cette fonction appelle la fonction
    <code class="literal">strptime()</code> fournie par la bibliothèque système C.
    Cette fonction a des comportements bien différents suivant les systèmes
    d&#039;exploitation. L&#039;utilisation de la fonction <span class="function"><a href="function.date-parse-from-format.php" class="function">date_parse_from_format()</a></span>,
    qui elle, ne souffre pas de ces défauts, est recommandée.
   </p>
  </p></blockquote>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    <code class="literal">&quot;tm_sec&quot;</code> inclut toutes les secondes intercalaires
    (actuellement 2 par an). Pour plus d&#039;informations sur les
    secondes intercalaires, se reporter à l&#039;<a href="http://en.wikipedia.org/wiki/Leap_second" class="link external">&raquo;&nbsp;article sur Wikipedia les concernant</a>.
   </p>
  </p></blockquote>
 </div>

 
 <div class="refsect1 seealso" id="refsect1-function.strptime-seealso">
  <h3 class="title">Voir aussi</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="methodname"><a href="intldateformatter.parse.php" class="methodname" rel="rdfs-seeAlso">IntlDateFormatter::parse()</a> - Analyse une cha&icirc;ne vers un timestamp</span></li>
    <li><span class="methodname"><a href="datetime.createfromformat.php" class="methodname" rel="rdfs-seeAlso">DateTime::createFromFormat()</a> - Analyse une heure au format texte selon le format sp&eacute;cifi&eacute;.</span></li>
    <li><span class="function"><a href="function.checkdate.php" class="function" rel="rdfs-seeAlso">checkdate()</a> - Valide une date gr&eacute;gorienne</span></li>
    <li><span class="function"><a href="function.strftime.php" class="function" rel="rdfs-seeAlso">strftime()</a> - Formate une date/heure locale avec la configuration locale</span></li>
    <li><span class="function"><a href="function.date-parse-from-format.php" class="function" rel="rdfs-seeAlso">date_parse_from_format()</a> - R&eacute;cup&egrave;re les informations d'une date donn&eacute;e suivant un format sp&eacute;cifique</span></li>
   </ul>
  </p>
 </div>

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