Is there a way to obtain a ISO string of a new date type in javascript with time at midnight without rebuilding a new date with date parts nor formatting it?
I've been trying this
var date = new Date();
date.setHours(0, 0, 0, 0);
document.write(date.toISOString());
and I am getting this
2017-04-20T04:00:00.000Z
I want to get this
2017-04-20T00:00:00.000Z
Is there a built-in function or way as I 've been trying to do to get the desired output (with rebuilding a date object with the date parts)?
var isoDate = new Date().toISOString().substring(0,10);
console.log(isoDate);