How to convert from UTC to local time in moment.js?
Try moment().local()
.
Example:
var gmtDateTime = moment.utc("2015-10-24 20:00", "YYYY-MM-DD HH")
var local = gmtDateTime.local().format('YYYY-MMM-DD h:mm A');
However, @antti-kuosmanen answer is accepted and correct.
moment().local()
is a correct way. But this can do in a single line. Here is how
var local = moment.utc("2015-10-24 20:00").local().format('YYYY-MMM-DD h:mm A');
No need to formating twice for the results
Cheers!! Read Simple Write Simple