Is something wrong with code.
var mom = moment("23-11-2016 00:00", "DD-MM-YYYY HH:mm");
alert(mom.toISOString());
//result 2016-11-22T17:00:00.000Z
Why the result is not 2016-11-23T00:00:00.000Z
? How I can get 2016-11-23T00:00:00.000Z
result?
Thanks in advance.
As the doc says:
while
.toISOString()
always returns a timestamp in UTC:You probably have -7 hours offset from UTC.
Use
format()
if you want to display date in local time.If your input string represents a UTC time, then use
moment.utc(String, String);