about summary refs log tree commit diff
path: root/usth/ICT3.2/prac/2/1.js
diff options
context:
space:
mode:
Diffstat (limited to 'usth/ICT3.2/prac/2/1.js')
-rw-r--r--usth/ICT3.2/prac/2/1.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/usth/ICT3.2/prac/2/1.js b/usth/ICT3.2/prac/2/1.js
new file mode 100644
index 0000000..ecc78f2
--- /dev/null
+++ b/usth/ICT3.2/prac/2/1.js
@@ -0,0 +1,9 @@
+const DAYS = ['Monday', 'Tuesday', 'Wednesday',
+              'Thursday', 'Friday', 'Saturday', 'Sunday'];
+const NOW = new Date();
+const HOUR24 = NOW.getHours();
+const HOUR12 = HOUR24 % 12;
+const PERIOD = HOUR24 < 12 ? 'AM' : 'PM';
+
+console.log(`Today is: ${DAYS[NOW.getDay()-1]}`);
+console.log(`Current time is: ${HOUR12} ${PERIOD}: ${NOW.getMinutes()}: ${NOW.getSeconds()}`)