moment("2013-12-31T19:51:57.000-0800").format("HH:mm")
yields a 24hr hour format in GMT but I would like it in local time "11:51"
.
Is this possible with moment's format method?
moment("2013-12-31T19:51:57.000-0800").format("HH:mm")
yields a 24hr hour format in GMT but I would like it in local time "11:51"
.
Is this possible with moment's format method?
That is incorrect. The code you gave will not show the the value in GMT. It will first adjust using the offset you gave it (-08:00), and then it will convert it to the correct offset as your own local time zone. So if you're time zone offset happens to be -08:00 for that particular time, you will see no conversion at all.
Also, you seem to be misunderstanding how the offset is applied. When you have an offset on an ISO8601 formatted string (like the one you supplied here), that means the time is already in the offset that is supplied. 19:51 is the local time that is in effect at the -8:00 offset.
To convert to UTC / GMT - you need to first invert the sign, then apply it. So the UTC time here is 3:51:57 AM on 2014-01-01.
Your requested output of 11:51 is not valid for this timestamp, no matter how you look at it.