aboutsummaryrefslogtreecommitdiff
path: root/static/time.js
diff options
context:
space:
mode:
Diffstat (limited to 'static/time.js')
-rw-r--r--static/time.js27
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);