JavaScript Dates – new Date and UTC
In JavaScript, we can create a new date using: var date1 = new Date(“2018-01-01″); If we print this in the console, we actually get a different date: This is because we are omitting the time, so UTC time is assumed. To display the “correct” date, add the time: var date1 = new Date(“2018-01-01 00:00”); This produces: