JavaScript Date Reference ... Converts the time portion of a Date object to a string: toUTCString() Converts a Date object to a string, according to universal time: UTC() Returns the number of milliseconds in a date since midnight of January 1, 1970, according to UTC time: valueOf() Using Date() var ts = new Date(); console.log(ts.toDateString()); # Mon Jun 22 2020 toISOString() The call to Date.parse(str) parses the string in the given format and returns the timestamp (number of milliseconds from 1 Jan 1970 UTC+0). JavaScript only has a Date object, which is misnamed since it is really a date+time. Date and time in JavaScript are represented with the Date object. Browser Support. If the format is invalid, returns NaN. Which means it cannot parse a time string HH:mm:ss without a date, but it can parse a date string. There are a few options. Convert time to a datetime string and parse using Date(). Method; toLocaleTimeString() Yes: Yes: Yes: Yes: Yes: Syntax. We can test this in the browser by creating a new variable and assigning to it a new Date instance based on a timestamp of 0 . Date.toLocaleTimeString() Technical Details. Use Momentjs String + Format parsing function. Converts a Date object to a string toTimeString Converts the time portion of a Date object to a string toUTCString() Converts a Date object to a string, according to universal time toDateString() You can learn more about toDateString in documentation. The toLocaleTimeString() method returns the time portion of a Date object as a string, using locale conventions.
Epoch time, also referred to as zero time, is represented by the date string 01 January, 1970 00:00:00 Universal Time (UTC), and by the 0 timestamp.