I'm using the Javascript new Date()
to store the date/time for a database entry. It's storing it in this format:
2021-01-20T16:59:34.768+00:00
Now, I need to get the exact same format from Moment JS, I've tried using: moment().format()
but there's a difference between the two:
- Moment JS:
2021-01-20T16:59:14.237+00:00
- JS new Date:
2021-01-20T16:59:14+00:00
It seems that .format()
doesn't match them up? I've also tried using .toDate()
which doesn't seem to give me the same format.
Need to get Moment JS to format the same as how new Date()
would