Back to the lesson

Create a date

importance: 5

Create a Date object for the date: Feb 20, 2012, 3:12am. The time zone is local.

Show it using alert.

The new Date constructor uses the local time zone by default. So the only important thing to remember is that months start from zero.

So February has number 1.

let d = new Date(2012, 1, 20, 3, 12);
alert( d );