test de décompte automatique

This commit is contained in:
thaaoblues 2023-04-19 15:42:01 +02:00
parent 76dd0a1219
commit eaada1049e
3 changed files with 43 additions and 1 deletions

View file

@ -10,3 +10,13 @@
margin-top: 40px;
border-radius: 15px;
}
#decompte{
margin-top: 5%;
width: 100%;
height: 200px;
font-size: 100px;
color: rgb(159, 73, 47);
}

View file

@ -0,0 +1,19 @@
<?php
// va calculer le delta entre la date du jour et la date de la semaine d'accueil
// pour la convertir en jours et la mettre dans un décompte
$date1 = time();
$date2 = strtotime("2023-09-12 00:00:00");
//$delta_date = $date1->diff($date2);
$delta_seconds = $date2-$date1;
// on utilise intdiv à la place de l'operateur / pour ne pas obtenir un float
$delta_days = intdiv($delta_seconds,(60*60*24));
$delta_hours = intdiv($delta_seconds % (60*60*24),60*60);
$delta_minutes = intdiv($delta_seconds % (60*60),60);
$delta_seconds = ($delta_seconds % (60));
?>

View file

@ -2,12 +2,25 @@
ob_start(); // Start reading html
include "assets/fonts/color.php";
include "assets/scripts/globals.php"
include "assets/scripts/globals.php";
include "assets/scripts/decompte.php";
?>
<main>
<div id="decompte">
<?php
if(($delta_days+$delta_hours+$delta_minutes+$delta_seconds)==0){
echo "<div id=\"fin_timer_egg\"><div>";
}
echo "J - ".$delta_days."j ".$delta_hours."h ".$delta_minutes."min ".$delta_seconds."s";
?>
</div>
<div id="msg_acc">