Moment.js 2.14.1

Parse, validate, manipulate, and display dates in JavaScript.

Download

moment.js moment.min.js 19.8k moment-with-locales.js moment-with-locales.min.js 60.5k

Install

bower install moment --save # bower
npm install moment --save   # npm
Install-Package Moment.js   # NuGet
spm install moment --save   # spm
meteor add momentjs:moment  # meteor

Format Dates

moment().format('MMMM Do YYYY, h:mm:ss a');
moment().format('dddd');
moment().format("MMM Do YY");
moment().format('YYYY [escaped] YYYY');
moment().format();

Relative Time

moment("20111031", "YYYYMMDD").fromNow();
moment("20120620", "YYYYMMDD").fromNow();
moment().startOf('day').fromNow();
moment().endOf('day').fromNow();
moment().startOf('hour').fromNow();

Calendar Time

moment().subtract(10, 'days').calendar();
moment().subtract(6, 'days').calendar();
moment().subtract(3, 'days').calendar();
moment().subtract(1, 'days').calendar();
moment().calendar();
moment().add(1, 'days').calendar();
moment().add(3, 'days').calendar();
moment().add(10, 'days').calendar();

Multiple Locale Support

moment.locale();
moment().format('LT');
moment().format('LTS');
moment().format('L');
moment().format('l');
moment().format('LL');
moment().format('ll');
moment().format('LLL');
moment().format('lll');
moment().format('LLLL');
moment().format('llll');
Afrikaans
Albanian
Arabic
Arabic (Morocco)
Arabic (Saudi Arabia)
Arabic (Tunisia)
Armenian
Azerbaijani
Basque
Belarusian
Bengali
Bosnian
Breton
Bulgarian
Burmese
Cambodian
Catalan
Central Atlas Tamazight
Central Atlas Tamazight Latin
Chinese (China)
Chinese (Taiwan)
Chuvash
Croatian
Czech
Danish
Dutch
English (Australia)
English (Canada)
English (Ireland)
English (New Zealand)
English (United Kingdom)
English (United States)
Esperanto
Estonian
Faroese
Finnish
French
French (Canada)
French (Switzerland)
Frisian
Galician
Georgian
German
German (Austria)
Greek
Hebrew
Hindi
Hungarian
Icelandic
Indonesian
Italian
Japanese
Japanese
Kazakh
Klingon
Korean
Kyrgyz
Lao
Latvian
Lithuanian
Luxembourgish
Macedonian
Malay
Malay
Malayalam
Maldivian
Marathi
Montenegrin
Nepalese
Northern Sami
Norwegian Bokmål
Nynorsk
Persian
Polish
Portuguese
Portuguese (Brazil)
Pseudo
Punjabi (India)
Romanian
Russian
Scottish Gaelic
Serbian
Serbian Cyrillic
Sinhalese
Slovak
Slovenian
Spanish
Spanish (Dominican Republic)
Swahili
Swazi
Swedish
Tagalog (Philippines)
Talossan
Tamil
Telugu
Thai
Tibetan
Turkish
Ukrainian
Uzbek
Vietnamese
Welsh