diff options
author | mounderfod <mounderfod@gmail.com> | 2023-06-22 19:19:12 +0100 |
---|---|---|
committer | mounderfod <mounderfod@gmail.com> | 2023-06-22 19:19:12 +0100 |
commit | 5c18591e97d2035a19d7975a5678bf9aa7a38b1d (patch) | |
tree | b4bb6d08fc129bfc83c3b5c87cb11b299b8825af /timedate.js | |
download | website-5c18591e97d2035a19d7975a5678bf9aa7a38b1d.tar.gz |
Initial commit
Diffstat (limited to 'timedate.js')
-rw-r--r-- | timedate.js | 15 |
1 files changed, 15 insertions, 0 deletions
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); |