Skip to content
Permalink
master
Go to file
 
 
Cannot retrieve contributors at this time
32 lines (23 sloc) 677 Bytes
title
Node.js
npm install moment
var moment = require('moment'); // require
moment().format(); 

Or in ES6 syntax:

import moment from 'moment';
moment().format();

Note: if you want to work with a particular variation of moment timezone, for example using only data from 2012-2022, you will need to import it from the builds directory like so:

import moment from 'moment-timezone/builds/moment-timezone-with-data-2012-2022';

Note: In 2.4.0, the globally exported moment object was deprecated. It will be removed in next major release.

You can’t perform that action at this time.