JavaScript Code


JavaScript – Parse Date String


Date – parse()

Date.parse()

parse() is a static method of Date class.

parse() method parses the given string representation of a date, and returns the number of milliseconds elapsed since January 1, 1970 00:00:00 UTC up to the parsed date.

Examples

1. Parse the date string and get the number of milliseconds elapsed since January 1, 1970 00:00:00 UTC.

let dateString = '13 Mar 2020 01:12:00 GMT';
let millis = Date.parse(dateString);
console.log(millis);


Copyright @2022