<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>timing</title>
    </head>
    <body>
        <div style="display: flex; justify-content: center; align-items: center;">
            <span>From June 31, 2019 to present:</span>
            <span id="timeid1" style="font-size:35px"></span>day<span id="timeid2" style="font-size:35px"></span>hours<span id="timeid3" style="font-size:35px"></span>points<span id="timeid4" style="font-size:35px"></span>seconds</div>
        <script type="text/javascript">
            function loveTime() {
                var the=new Date(2019.6.31) 
                var date = new Date() - the
                var days = Math.floor(date / 1000 / 60 / 60 / 24) // Start here
                var daysmod = date - days * 24 *60 * 60 * 1000 
                var hours = Math.floor(daysmod / 1000 / 60 / 60) 
                var hoursmod = date - (days * 24 *60 * 60 * 1000) - (hours * 1000 * 60 * 60) 
                var minutes = Math.floor(hoursmod / 1000 / 60)
                var minutesmod = date - (days * 24 *60 * 60 * 1000) - (hours * 1000 * 60 * 60) - (minutes * 1000 * 60)
                var seconds = Math.floor(minutesmod / 1000) // Convert the total number of milliseconds to the corresponding number of days + hours + minutes + seconds
                var daysshow = document.getElementById("timdid1");
                var ds = document.getElementById("timeid1");
                var hs = document.getElementById("timeid2");
                var ms = document.getElementById("timeid3");
                var ss = document.getElementById("timeid4");
                ds.innerHTML = days;
                hs.innerHTML = hours;
                ms.innerHTML = minutes;
                ss.innerHTML = seconds;
            }
            // Write the time every second using a timer
            setInterval("loveTime();".1000);

        </script>
    </body>
    </html>
Copy the code