What is the difference in the number of milliseconds returned by the Date object in js? For example, the difference between Date.now and Date.prototype.valueOf ()?

The

Date.now () method, the Date.prototype.getTime () method, and the Date.prototype.valueOf () method all seem to return milliseconds? What"s the difference between them? Is there anything you need to pay attention to in usage?

Mar.22,2021

Date.now () is to get the current millisecond timestamp, as the name implies. The
getTime, like the valueOf method, can get the millisecond timestamp of any Date object.

Menu