JavaScript › Date, Time & Internationalization (Intl API)
How do you create a Date object representing the current moment?
BeginnerAnswer
new Date() with no arguments creates a Date object set to the current date and time, based on the system clock, represented internally as milliseconds since the Unix epoch (Jan 1, 1970 UTC).
const now = new Date();
console.log(now.getTime()); // e.g. 1770512400000Real-world example Timestamping when a user submits a form, for auditing or sorting purposes.