summary refs log blame commit diff stats
path: root/timedate.js
blob: a9562ab5484a2c32a9c2f51bdf0ec2aca06a8388 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15














                                                                    
updateDate = () => {
  const d = new Date();
  $("#timedate").text(
    `The time is ${(d.getHours() < 10 ? "0" : "") + d.getHours()}:${
      (d.getMinutes() < 10 ? "0" : "") + d.getMinutes()
    }:${
      (d.getSeconds() < 10 ? "0" : "") + d.getSeconds()
    } and the date is ${d.toLocaleString("en-us", {
      weekday: "long",
    })} ${d.getDate()} ${d.toLocaleString("en-us", {
      month: "long",
    })} ${d.getFullYear()}`
  );
};
time = setInterval(updateDate, 1000);