moment js timezone code example
Example 1: moment date without timezone
moment().utcOffset(0, true).format()
Example 2: moment get timezone
var tz = moment.tz.guess();
Example 3: momentTimeZone
var newYork = moment.tz("2014-06-01 12:00", "America/New_York");
var losAngeles = newYork.clone().tz("America/Los_Angeles");
var london = newYork.clone().tz("Europe/London");
newYork.format(); // 2014-06-01T12:00:00-04:00
losAngeles.format(); // 2014-06-01T09:00:00-07:00
london.format(); // 2014-06-01T17:00:00+01:00
Example 4: moment js npm
moment.locale(); // en
moment().format('LT'); // 8:41 PM
moment().format('LTS'); // 8:41:43 PM
moment().format('L'); // 04/11/2020
moment().format('l'); // 4/11/2020
moment().format('LL'); // April 11, 2020
moment().format('ll'); // Apr 11, 2020
moment().format('LLL'); // April 11, 2020 8:41 PM
moment().format('lll'); // Apr 11, 2020 8:41 PM
moment().format('LLLL'); // Saturday, April 11, 2020 8:41 PM
moment().format('llll'); // Sat, Apr 11, 2020 8:41 PM
// undefined
Example 5: moment to javascript date
let now = moment()
let now = now.toDate()
Example 6: momentjs docs
npm install moment