Apologies if duplicate
I have a date in Mon May 29 2017 12:36:49 GMT+0000
and I want to convert it into 2017-05-01T19:04:18Z
How can i do that using JavaScript.
Here is my code
var targetDate = new Date();
targetDate.setDate(targetDate.getDate() - 5);
console.log("targetDate is "+targetDate);
I am getting output like targetDate is Mon May 29 2017 12:36:49 GMT+0000
but I want it in 2017-05-01T19:04:18Z
format
Any help appreciated, Thanks in advance