For the oData Rest service, I use Moment.js to create a date from a Unix timestamp, and I would like to ignore the time zone. My date is "2013-12-24", which is 1387839600 in Unix seconds.
Using
moment("2013-12-24", "YYYY-MM-DD").toISOString()
leads to "2013-12-23T23: 00: 00.000Z" since I live in GMT + 1. Using
moment.utc("2013-12-24", "YYYY-MM-DD").toISOString()
I get "2013-12-24T00: 00: 00.000Z", which is what I want. I can simply remove the Zulu time āZā at the end.
But my real representation of the date is the Unix timestamp. So if i do
moment.utc(1387839600, "X").toISOString()
I always get "2013-12-23T23: 00: 00.000Z", but I want him to return "2013-12-24T00: 00: 00.000Z".
Where is my fault Thank you for your help!
javascript date datetime momentjs
Windwalker
source share