Skip to content

Commit

Permalink
Fixed date & time
Browse files Browse the repository at this point in the history
  • Loading branch information
HastDu authored Oct 24, 2024
1 parent 353ccc9 commit 0d4ddc0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions public/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ const period = document.getElementById("period");

setInterval(() => {
const now = new Date();
const day = now.getDate(); // returns a number representing the day of the week, starting with 0 for Sunday
const month = now.getMonth();
const day = now.getDate();
const hours = now.getHours();
const minutes = now.getMinutes();
const seconds = now.getSeconds();
document.getElementById("period").innerHTML= `Today is day ${day} and the time is ${hours}:${minutes}:${seconds}.`;
document.getElementById("period").innerHTML= `Today is: ${month} ${day}, ${hours}:${minutes}:${seconds}`;
}, 500);

0 comments on commit 0d4ddc0

Please sign in to comment.