Get the current date in JavaScript
Question:
How to get the current date in JavaScript? Answer:
let now = new Date();
console.log('The current date is: ' + now);
Description:
JavaScript Date
objects represent a single moment in time in a platform-independent format. Date objects contain a Number that represents milliseconds since 1 January 1970 UTC.
The Date()
constructor creates a new Date
object with the actual time value.
Reference:
Date manual
Share "How to get the current date in JavaScript?"
Related snippets:
Tags:
javascript, date, Technical term:
Get the current date in JavaScript