Exécuter
❯
Exécuter le code
Ctrl+Alt+R
Changer d'orientation
Ctrl+Alt+O
Changer de thème
Ctrl+Alt+D
<!DOCTYPE html> <html> <body> <?php $date1=date_create("2013-01-01"); $date2=date_create("2013-02-10"); $diff=date_diff($date1,$date2); // %a affiche le nombre total de jours echo $diff->format("Nombre total de jours : %a."); echo "<br>"; // %R affiche + car $date2 est après $date1 (un intervalle positif) echo $diff->format("Nombre total de jours : %R%a."); echo "<br>"; // %d affiche le nombre de jours qui n'est pas déjà couvert par le mois echo $diff->format("Mois : %m, jours : %d."); ?> </body> </html>