Listing date/time details of current locale


Advertisements

You can set the locale and check the details like months, weekdays etc. In the examples given here, we have set the locale to French and below example shows the months, weekdays for French locale.

Locale Month

This method will get the months for the locale set.

Syntax

moment.months();
moment.monthsShort();

Example

moment.locale('fr');
var m = moment.months();
JSON.stringify(m);

Output

Locale Set

Example

moment.locale('fr');
var m = moment.monthsShort();
JSON.stringify(m);

Output

Locale Month

Weekdays

Syntax

moment.weekdays()
moment.weekdaysShort()
moment.weekdaysMin()

Example

moment.locale('fr');
var m = moment.weekdays();
JSON.stringify(m);

Output

Weekdays

Example

moment.locale('fr');
var m = moment.weekdaysShort();
JSON.stringify(m);

Output

weekdaysShort

Example

moment.locale('fr');
var m = moment.weekdaysMin();
JSON.stringify(m);

Output

weekdaysMin

Example

moment.locale('fr');
var m = moment.weekdays(4);

The above examples displays the fourth day of the week.

Output

Weekdays Fourth Day

Example

moment.locale('fr');
var m = moment.weekdays(true);

The locale is set to French. When true is passed to weekdays it will display the output as Saturday to Friday in French.

Output

Weekdays Locale

Example

moment.locale('fr');
var m = moment.weekdays(true, 1);

It will display Sunday as per French.

Output

Weekdays French
momentjs_internationalization.htm
Advertisements