How to make js execute repeatedly

I found a js code from the Internet to calculate the time difference
effect is that we have been together xx days xx xx minutes xx seconds
problem is that this time will not change
only enter the web page after refreshing to keep the same value
so I want this code to be executed once a second so that the number can be changed every second
consult
I can html css but js ability So 0
it"s best to be as detailed as a fool.
Thank you, boss

.
<div class=" foot">
    <script>
            var date1= "2016/05/03 00:00:00";
            var date2 = new Date();
            var date3 = date2.getTime() - new Date(date1).getTime();
            var days=Math.floor(date3/(24*3600*1000));
            var leave1=date3%(24*3600*1000)  ;
            var hours=Math.floor(leave1/(3600*1000));
            var leave2=leave1%(3600*1000);
            var minutes=Math.floor(leave2/(60*1000));
            var leave3=leave2%(60*1000)   ;
            var seconds=Math.round(leave3/1000);
            alert("  "+days+" "+hours+" "+minutes+" "+seconds+" ");
    </script>
</div>
Feb.28,2021

timer setInterval

The
setInterval () method calls a function or executes a code snippet repeatedly, with a fixed time delay between each call.
returns an intervalID.
setInterval(function () {
    var date1 = '2016/05/03 00:00:00';
    var date2 = new Date();
    var date3 = date2.getTime() - new Date(date1).getTime();
    var days = Math.floor(date3 / (24 * 3600 * 1000));
    var leave1 = date3 % (24 * 3600 * 1000);
    var hours = Math.floor(leave1 / (3600 * 1000));
    var leave2 = leave1 % (3600 * 1000);
    var minutes = Math.floor(leave2 / (60 * 1000));
    var leave3 = leave2 % (60 * 1000);
    var seconds = Math.round(leave3 / 1000);
    console.log("  " + days + " " + hours + " " + minutes + " " + seconds + " ");
}, 1000)

there is an open source library for moment. You can take a look at

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bc8e39-12e75.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bc8e39-12e75.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?