Moment.js 2.13.0

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

Download

moment.js moment.min.js 14.9k moment-with-locales.js moment-with-locales.min.js 54.1k

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
Bahasa Indonesia
Bahasa Melayu (Malaysia)
Basque
Belarusian
Bengali
Bosnian
Breton
Bulgarian
Burmese
Catalan
Chinese (Simplified)
Chinese (Traditional)
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
Italian
Japanese
Javanese
Kazakh
Khmer (Cambodia)
Klingon
Korean
Lao
Latvian
Lithuanian
Luxembourgish
Macedonian
Malayalam
Maldivian
Marathi
Montenegrin
Nepalese
Northern Sami
Norwegian
Norwegian Nynorsk
Persian
Polish
Portuguese
Portuguese (Brazil)
Romanian
Russian
Scottish Gaelic
Serbian
Serbian Cyrillic
Sinhalese
Slovak
Slovenian
Spanish
Swahili
Swedish
Tagalog (Filipino)
Talossan
Tamaziɣt
Tamaziɣt Latin
Tamil
Telugu
Thai
Tibetan
Turkish
Ukrainian
Uzbek
Vietnamese
Welsh