var d = new Date();
var time = d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate() + " " + d.getHours() + ":" + d.getMinutes();
document.getElementById("currentDay").innerHTML = time;
Asked
Active
Viewed 39 times
-4

Phil
- 157,677
- 23
- 242
- 245
-
Specifically look at [this answer](https://stackoverflow.com/a/51738434/4604701) on the above question. – fubar May 10 '21 at 00:12
1 Answers
-1
Try putting your code in an interval. That way, it will be called every second.
setInterval(() => {
//Your code here
},1000);

M-Coder
- 70
- 6