JavaScriptDatenew Date

Creates a new Date object representing the current date and time.

Syntax

new Date()

Example

Enter values below to update the example in real time.

const
new
console
specific
Jan
toISOString
const now = new Date();
console.log(now);   // Current date and time

const specific = new Date(2024, 0, 1);   // Jan 1, 2024
console.log(specific.toISOString());