Using the Date Object
Problem
You need to get date and time information.
Solution
You need to create an instance of the Date object. Depending on if you need the current time or some other time in the past or future, you may need to pass parameters to the constructor .
The Code
Listing 6-1. Creating Instances of the Date Object
var now = new Date(); //returns todays date and time
console.log(now);
var fluxCapacitorDate = new Date('November 5, 1955');
console.log(fluxCapacitorDate); //returns the date with time being all 0’ meaning midnight of that ...