The Date objects parse() method parses a date string and returns the number of milliseconds between the date string and midnight of January 1, 1970.
For example: In the example below, we pass a date string, which lets assume is your date of birth to the parse() method, and the method will return milliseconds between my DOB and midnight of January 1, 1970.
var DOB = “March 1, 1995”;
var millisecondsBetweenDOBAnd1970 = Date.parse(DOB);
Now the questions is What can this be used for ?
Using the example, above we can easily understand where Date.parse() method can be used.
First Parse the Date of Birth, then use the Date.now() method to get milliseconds between now (present date and time) and midnight of January 1, 1970.
Full tutorial & Video demo: Calculate age of a person using Date.now() and Date.parse() method.