Moment JS useful functions

List all timezones

moment.tz.names();

Date time to unix timestamp:

var CurrentDate = moment().unix();

Convert to different timezone

var moment = require('moment-timezone');
moment().tz("America/Los_Angeles").format();

Get users current timezone

var tz = moment.tz.guess();

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *