Jighead
8/1/2017 - 3:39 PM

Displays the Current date and time

Displays the Current date and time

var today = new Date();
var day = today.getDay();
var month = today.getMonth();
var year = today.getFullYear();
var hour = today.getHours();
var minute = today.getMinutes();
var second = today.getSeconds();
var daylist = ["Sunday","Monday","Tuesday","Wednesday ","Thursday","Friday","Saturday"];
var monthlist = ["Jan","Feb","Mar","April ","May","June","July","Aug", "Sept", "Oct", "Nov", "Dec"];
var prepand = (hour => 12)? " PM" : " AM";

console.log("Today is: " + daylist[day] + " " + monthlist[month] +" "+ year + "." );
//console.log("Current time is : "+ hour + ":" + minute + ":" + second + "" + prepand);
console.log("The current time is : "+ hour + ":" + minute + "" + prepand);