-3

I want to convert the date object to string but I want it in the same format as it is displayed when I do console.log(new Date()) which is something like '2019-05-21T11:55:39.496Z' and not the usual extended format we get when we do console.log(new Date().toString()) which is something like this 'Tue May 21 2019 17:28:51 GMT+0530 (India Standard Time)'.

nishchayp
  • 1
  • 1
  • 1
    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString – ADyson May 21 '19 at 12:04
  • Duplicate of https://stackoverflow.com/questions/15257911/create-an-iso-date-object-in-javascript – str May 21 '19 at 12:08

1 Answers1

-1
console.log(new Date().toISOString())
2019-05-21T12:03:50.601Z
niccord
  • 680
  • 3
  • 12