Get started with moment-timezone CDN

MIT licensed

Moment-timezone is a library that extends Moment.js for handling timezones.

Tags:
  • date
  • moment
  • timezone
  • time

Stable version

Copied!

How to start using moment-timezone CDN


// Include the CDN link
const moment = require('moment-timezone')(require('moment/moment'));
moment.tz.add(['America/Los_Angeles'], {'abbr': 'PST', 'dstOffset': 240});

// Set the time in New York
const nyTime = moment.utc('2022-12-31T23:59:59').tz('America/New_York');

// Convert the time to Pacific Standard Time (PST)
const pstTime = nyTime.tz('America/Los_Angeles');

console.log('New York Time:', nyTime.format());
console.log('Pacific Standard Time:', pstTime.format());
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!

All versions