MomentJS - Month


Advertisements

This method gets/sets the month. The range is from 0-11, if greater it will show the next year, if negative it will show the last year.

Syntax

moment().month(Number|String);
moment().month();

Example

var m = moment().month();
var d = moment().month(8);
var a = moment().month("November");
var k = moment().month(20);
var o = moment().month(-5);

Output

Month
momentjs_getter_setter.htm
Advertisements