about summary refs log tree commit diff
path: root/usth/ICT3.2/prac/2/1.js
blob: ecc78f21841b26f4718e94a869af61e8f713528e (plain) (blame)
1
2
3
4
5
6
7
8
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()}`)