0

I am using JSON.strigify to convert JSON object to a string, but in the process, it is also converting the local date to UTC date hence returning the date in the following format.

"2017-04-30T18:30:00.000Z"

I don't want it to happen and want to keep the date as is.

  • I think it will do this for dates. You could maybe turn it into a string yourself before running `JSON.stringify`? – Arg0n Jun 02 '17 at 12:41
  • 1
    You can't "keep the date as it is": It is a Date object and JSON doesn't have a Date type. – Quentin Jun 02 '17 at 12:42
  • You can take a look at [this](https://momentjs.com/timezone/), it can help you with date and timezone stuff or check [this post](https://stackoverflow.com/q/31096130/6712896) or [this one](https://stackoverflow.com/questions/1486476/json-stringify-changes-time-of-date-because-of-utc), I think it's the same problem as you – JeanJacques Jun 02 '17 at 12:54

1 Answers1

0

You can try of this Options

new Date("2017-04-30T18:30:00.000Z");

It Gives you date format you want