diff options
author | Bryson Steck <brysonsteck@protonmail.com> | 2022-12-27 00:48:42 -0700 |
---|---|---|
committer | Bryson Steck <brysonsteck@protonmail.com> | 2022-12-27 00:48:42 -0700 |
commit | 199f5ca505ca7392b3e770e83c5150a9f897d6d0 (patch) | |
tree | c8a4c1b5576db270b8b73ae848bc0e76e3ad6001 /static/time.js | |
parent | 4cd9efaf56b61e86782e13a5b15411b679b5c259 (diff) | |
download | website-199f5ca505ca7392b3e770e83c5150a9f897d6d0.tar website-199f5ca505ca7392b3e770e83c5150a9f897d6d0.tar.gz website-199f5ca505ca7392b3e770e83c5150a9f897d6d0.tar.bz2 |
somewhat functional website now
Diffstat (limited to 'static/time.js')
-rw-r--r-- | static/time.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/static/time.js b/static/time.js new file mode 100644 index 0000000..3e5650d --- /dev/null +++ b/static/time.js @@ -0,0 +1,27 @@ +function updateTime(){ + var date = new Date() + var hours = date.getHours() + var minutes = date.getMinutes() + var seconds = date.getSeconds() + + var old_hours = hours; + if (hours > 12) { + hours = hours - 12 + } else if (hours == 0) { + hours = 12 + } + + if (minutes < 10) { + minutes = "0" + minutes + } + + var t_str = hours + ":" + minutes; + if (old_hours > 11) { + t_str += " pm"; + } else { + t_str += " am"; + } + + document.getElementById('time').innerHTML = t_str; +} +setInterval(updateTime, 1); |