I want to get month name from two digit month number (ex- 09). I tried with this code. But it doesn\'t work. The code give current month name only. What are the correct code for
While there's nothing wrong with Kevin's answer, it is probably more correct (in terms of efficiency) to obtain the month string without going through a moment
object.
var monthNum = 9; // assuming Jan = 1
var monthName = moment.months(monthNum - 1); // "September"
var shortName = moment.monthsShort(monthNum - 1); // "Sep"