Display datetime with MomentJs without timezone conversion

Use the utc() method of moment to remove the timezone and display everything in universal time.

moment.utc('2015-01-22T16:11:36.36-07:00').format('l LT')

That will display the time as it is in UTC without any timezone offset. If you want to display the time as it was recorded in the user/server timezone you can parse the zone information when you construct a moment instance and have it use the timezone recorded in the parsed string.

moment.parseZone('2015-01-22T16:11:36.36-07:00').format('l LT');

With either of these approaches you should consider labeling the time in some way to reflect the timezone the time corresponds to. Failing to do this could lead to a lot of confusion for the end users.


I created an extension to display the datetime without trying to adjust to the user's timezone:

(function (moment) {
    moment.fn.nozone = function () {
        var m1 = moment(this);
        var offsetInMinutes = m1.utcOffset();
        return m1.utc().add(offsetInMinutes, 'm');
    };
}(moment));

This way it is easily reusable, even in javascript templates.


You can use the utcOffset method to set the offset manually.

moment().utcOffset(0, true).format()