Skip to content

Commit

Permalink
Added month names
Browse files Browse the repository at this point in the history
  • Loading branch information
HastDu authored Oct 24, 2024
1 parent 70a5ae7 commit 91d8d7b
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions public/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
const period = document.getElementById("period");

setInterval(() => {
const now = new Date();
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: ${month} ${day}, ${hours}:${minutes}:${seconds}`;
document.getElementById("title").innerHTML= `${month} ${day}`;
const now = new Date();
const month = now.getMonth();
const monthname = months[month];
const day = now.getDate();
const hours = now.getHours();
const minutes = now.getMinutes();
const seconds = now.getSeconds();
var months = [ "January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December" ];

document.getElementById("period").innerHTML = `Today is: ${monthname} ${day}, ${hours}:${minutes}:${seconds}`;
document.getElementById("title").innerHTML = `${monthname} ${day}`;
}, 250);

0 comments on commit 91d8d7b

Please sign in to comment.