<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.calendar.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'fr',
  ),
  'this' => 
  array (
    0 => 'function.easter-date.php',
    1 => 'easter_date',
    2 => 'Retourne le timestamp Unix pour minuit local le jour de P&acirc;ques d\'une ann&eacute;e donn&eacute;e',
  ),
  'up' => 
  array (
    0 => 'ref.calendar.php',
    1 => 'Calendar Fonctions',
  ),
  'prev' => 
  array (
    0 => 'function.cal-to-jd.php',
    1 => 'cal_to_jd',
  ),
  'next' => 
  array (
    0 => 'function.easter-days.php',
    1 => 'easter_days',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'fr',
    'path' => 'reference/calendar/functions/easter-date.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.easter-date" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">easter_date</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">easter_date</span> &mdash; <span class="dc-title">Retourne le timestamp Unix pour minuit local le jour de Pâques d&#039;une année donnée</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.easter-date-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>easter_date</strong></span>(<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.integer.php" class="type int">int</a></span></span> <code class="parameter">$year</code><span class="initializer"> = <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong></span></span>, <span class="methodparam"><span class="type"><a href="language.types.integer.php" class="type int">int</a></span> <code class="parameter">$mode</code><span class="initializer"> = <strong><code><a href="calendar.constants.php#constant.cal-easter-default">CAL_EASTER_DEFAULT</a></code></strong></span></span>): <span class="type"><a href="language.types.integer.php" class="type int">int</a></span></div>

  <p class="para rdfs-comment">
   Retourne un timestamp UNIX pour Pâques, à minuit, pour une année donnée.
  </p>
  <p class="para">
   La date de Pâques a été fixée par le concile
   de Nicée, en 325 de notre ère, comme étant le dimanche
   après la première pleine lune qui suit l&#039;équinoxe de
   printemps. L&#039;équinoxe de printemps est considéré
   comme étant toujours le 21 mars, ce qui réduit le
   problème au calcul de la date de la lune pleine qui suit, et le
   dimanche suivant. L&#039;algorithme fut introduit vers 532, par Dionysius
   Exiguus. Avec le calendrier julien (pour les années avant 1753),
   un cycle de 19 ans suffit pour connaître les dates des phases de la
   lune. Avec le calendrier grégorien (à partir des années
   1753, conçu par Clavius et Lilius, puis introduit par le pape Grégoire XIII
   en octobre 1582, et en Grande-Bretagne et ses colonies en septembre 1752),
   deux facteurs de correction ont été ajoutés pour rendre
   le cycle plus précis.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.easter-date-parameters">
  <h3 class="title">Liste de paramètres</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">year</code></dt>
     <dd>
      <p class="para">
       L&#039;année, doit être un nombre compris entre 1970 et 2037 pour les systèmes 32 bits, ou entre 1970 et 2 000 000 000 pour les systèmes 64 bits.
       Si omis ou <strong><code><a href="reserved.constants.php#constant.null">null</a></code></strong>, la valeur par défaut sera l&#039;année courante suivant l&#039;heure locale.
      </p>
     </dd>
    
    
     <dt><code class="parameter">mode</code></dt>
     <dd>
      <p class="para">
       Permet de calculer la date de Pâques en fonction du calendrier julien
       quand défini à <strong><code><a href="calendar.constants.php#constant.cal-easter-always-julian">CAL_EASTER_ALWAYS_JULIAN</a></code></strong>. Voir aussi
       <a href="calendar.constants.php" class="link">les constantes de calendrier</a>.
       </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.easter-date-returnvalues">
  <h3 class="title">Valeurs de retour</h3>
  <p class="para">
   La date pour Pâques, sous la forme d&#039;un timestamp unix.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-function.easter-date-errors">
  <h3 class="title">Erreurs / Exceptions</h3>
  <p class="para">
   Une <span class="classname"><a href="class.valueerror.php" class="classname">ValueError</a></span> est déclenchée si l&#039;année est antérieure à 1970 ou postérieure à 2037
   lors de l&#039;exécution sur un système 32 bits, ou postérieure à 2 000 000 000 sur un système 64 bits.
  </p>
 </div>


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

    </thead>

    <tbody class="tbody">
     <tr>
      <td>8.3.0</td>
      <td>
       Sur les systèmes 64 bits, le paramètre <code class="parameter">year</code> accepte désormais des valeurs dans la plage de 1970 à
       2 000 000 000.
      </td>
     </tr>

     <tr>
      <td>8.0.0</td>
      <td>
       <code class="parameter">year</code> est désormais nullable.
      </td>
     </tr>

     <tr>
      <td>8.0.0</td>
      <td>
       Une <span class="classname"><a href="class.valueerror.php" class="classname">ValueError</a></span> est désormais déclenchée lorsque
       <code class="parameter">year</code> est en dehors de la plage autorisée.
       Auparavant, une alerte <strong><code><a href="errorfunc.constants.php#constant.e-warning">E_WARNING</a></code></strong> était générée
       et la fonction retournait <strong><code><a href="reserved.constants.php#constant.false">false</a></code></strong>.
      </td>
     </tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-function.easter-date-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>easter_date()</strong></span></strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">date</span><span style="color: #007700">(</span><span style="color: #DD0000">"M-d-Y"</span><span style="color: #007700">, </span><span style="color: #0000BB">easter_date</span><span style="color: #007700">(</span><span style="color: #0000BB">1999</span><span style="color: #007700">));        </span><span style="color: #FF8000">// Apr-04-1999<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">date</span><span style="color: #007700">(</span><span style="color: #DD0000">"M-d-Y"</span><span style="color: #007700">, </span><span style="color: #0000BB">easter_date</span><span style="color: #007700">(</span><span style="color: #0000BB">2000</span><span style="color: #007700">));        </span><span style="color: #FF8000">// Apr-23-2000<br /></span><span style="color: #007700">echo </span><span style="color: #0000BB">date</span><span style="color: #007700">(</span><span style="color: #DD0000">"M-d-Y"</span><span style="color: #007700">, </span><span style="color: #0000BB">easter_date</span><span style="color: #007700">(</span><span style="color: #0000BB">2001</span><span style="color: #007700">));        </span><span style="color: #FF8000">// Apr-15-2001<br /><br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

   </div>
   <div class="example" id="example-2">
    <p><strong>Exemple #2 Utilisation de <span class="function"><strong>easter_date()</strong></span> avec <span class="classname"><a href="class.datetime.php" class="classname">DateTime</a></span></strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /><br />$timestamp </span><span style="color: #007700">= </span><span style="color: #0000BB">easter_date</span><span style="color: #007700">(</span><span style="color: #0000BB">2023</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$datetime </span><span style="color: #007700">= new </span><span style="color: #0000BB">\DateTime</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$datetime</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setTimestamp</span><span style="color: #007700">(</span><span style="color: #0000BB">$timestamp</span><span style="color: #007700">);<br /><br />echo </span><span style="color: #0000BB">$datetime</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">format</span><span style="color: #007700">(</span><span style="color: #DD0000">'M-d-Y'</span><span style="color: #007700">); </span><span style="color: #FF8000">// Apr-09-2023<br /><br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

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


 <div class="refsect1 notes" id="refsect1-function.easter-date-notes">
  <h3 class="title">Notes</h3>
  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    La fonction <span class="function"><strong>easter_date()</strong></span> repose sur les fonctions
    de la bibliothèque C time du système, plutôt que sur les fonctions
    date et time internes de PHP. Aussi, la fonction <span class="function"><strong>easter_date()</strong></span>
    utilise la variable d&#039;environnement <code class="literal">TZ</code> pour déterminer
    le fuseau horaire à utiliser, plutôt que le
    <a href="datetime.configuration.php#ini.date.timezone" class="link">fuseau horaire par défaut</a> de PHP,
    ce qui peut conduire à un comportement non désiré lors de l&#039;utilisation
    de cette fonction avec d&#039;autres fonctions date de PHP.
   </p>
   <p class="para">
    Comme contournement, il est possible d&#039;utiliser la fonction
    <span class="function"><a href="function.easter-days.php" class="function">easter_days()</a></span> avec les classes
    <span class="classname"><a href="class.datetime.php" class="classname">DateTime</a></span> et <span class="classname"><a href="class.dateinterval.php" class="classname">DateInterval</a></span>
    pour calculer le jour de Pâques dans le fuseau horaire PHP, comme ceci :
   </p>
   <div class="informalexample">
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #007700">function </span><span style="color: #0000BB">get_easter_datetime</span><span style="color: #007700">(</span><span style="color: #0000BB">$year</span><span style="color: #007700">) {<br />    </span><span style="color: #0000BB">$base </span><span style="color: #007700">= new </span><span style="color: #0000BB">DateTime</span><span style="color: #007700">(</span><span style="color: #DD0000">"</span><span style="color: #0000BB">$year</span><span style="color: #DD0000">-03-21"</span><span style="color: #007700">);<br />    </span><span style="color: #0000BB">$days </span><span style="color: #007700">= </span><span style="color: #0000BB">easter_days</span><span style="color: #007700">(</span><span style="color: #0000BB">$year</span><span style="color: #007700">);<br /><br />    return </span><span style="color: #0000BB">$base</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">add</span><span style="color: #007700">(new </span><span style="color: #0000BB">DateInterval</span><span style="color: #007700">(</span><span style="color: #DD0000">"P</span><span style="color: #007700">{</span><span style="color: #0000BB">$days</span><span style="color: #007700">}</span><span style="color: #DD0000">D"</span><span style="color: #007700">));<br />}<br /><br />foreach (</span><span style="color: #0000BB">range</span><span style="color: #007700">(</span><span style="color: #0000BB">2012</span><span style="color: #007700">, </span><span style="color: #0000BB">2015</span><span style="color: #007700">) as </span><span style="color: #0000BB">$year</span><span style="color: #007700">) {<br />    </span><span style="color: #0000BB">printf</span><span style="color: #007700">(</span><span style="color: #DD0000">"Pâques, en %d, tombe le %s\n"</span><span style="color: #007700">,<br />           </span><span style="color: #0000BB">$year</span><span style="color: #007700">,<br />           </span><span style="color: #0000BB">get_easter_datetime</span><span style="color: #007700">(</span><span style="color: #0000BB">$year</span><span style="color: #007700">)-&gt;</span><span style="color: #0000BB">format</span><span style="color: #007700">(</span><span style="color: #DD0000">'d F'</span><span style="color: #007700">));<br />}<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

    <p class="para">L&#039;exemple ci-dessus va afficher :</p>
    <div class="example-contents screen">
<div class="notescode"><pre class="notescode">Pâques, en 2012, tombe le 08 Avril
Pâques, en 2013, tombe le 31 Mars
Pâques, en 2014, tombe le 20 Avril
Pâques, en 2015, tombe le 05 Avril</pre>
</div>
    </div>
   </div>
  </p></blockquote>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.easter-date-seealso">
  <h3 class="title">Voir aussi</h3>
  <p class="para">
   <ul class="simplelist">
    <li>
     <span class="function"><a href="function.easter-days.php" class="function" rel="rdfs-seeAlso">easter_days()</a> - Retourne le nombre de jours entre le 21 Mars et P&acirc;ques, pour une ann&eacute;e donn&eacute;e</span> pour le calcul de Pâques
     avant 1970 et après 2037
    </li>
   </ul>
  </p>
 </div>

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