From 5c18591e97d2035a19d7975a5678bf9aa7a38b1d Mon Sep 17 00:00:00 2001 From: mounderfod Date: Thu, 22 Jun 2023 19:19:12 +0100 Subject: Initial commit --- timedate.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 timedate.js (limited to 'timedate.js') diff --git a/timedate.js b/timedate.js new file mode 100644 index 0000000..a9562ab --- /dev/null +++ b/timedate.js @@ -0,0 +1,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); -- cgit 1.4.1-2-gfad0