<?php
// Set the timezone
date_default_timezone_set('UTC');

// Set the fixed start date
$startDate = new DateTime('2024-10-20');

// Clone the start date and add 5 months to it

$endDate = clone $startDate;

$endDate->modify('+4 months');
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Countdown</title>
    <script>
        function countdown() {
            var endDate = new Date("<?php echo $endDate->format('Y-m-d H:i:s'); ?>").getTime();
            var now = new Date().getTime();
            var distance = endDate - now;

            var months = Math.floor(distance / (1000 * 60 * 60 * 24 * 30));
            var days = Math.floor((distance % (1000 * 60 * 60 * 24 * 30)) / (1000 * 60 * 60 * 24));
            var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
            var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
            var seconds = Math.floor((distance % (1000 * 60)) / 1000);

            document.getElementById("countdown").innerHTML = months + " months, " + days + " days, " + hours + " hours, " + minutes + " minutes, " + seconds + " seconds";

            if (distance < 0) {
                clearInterval(x);
                document.getElementById("countdown").innerHTML = "EXPIRED";
            }
        }

        setInterval(countdown, 1000);
    </script>
</head>
<body>
    <h1>Countdown</h1>
    <p id="countdown"></p>
</body>
</html>
