- MomentJS Tutorial
- MomentJS - Home
- MomentJS - Overview
- MomentJS - Environment Setup
- MomentJS - Introduction
- MomentJS - Parsing Date And Time
- MomentJS - Date Validation
- MomentJS - Getter/Setter
- Manipulate Date And Time
- Formatting Date And Time
- MomentJS - Date Queries
- MomentJS - Internationalization
- MomentJS - Customization
- MomentJS - Durations
- MomentJS - Utilities
- MomentJS - Plugins
- MomentJS - Examples
- MomentJS Useful Resources
- MomentJS - Quick Guide
- MomentJS - Useful Resources
- MomentJS - Discussion
MomentJS - Days in Month
This method will give the numbers of days in the current month.
Syntax
moment().daysInMonth();
Example
var a = moment().daysInMonth();
Output
Example
Let us check the days in a month for a given date using this method. Use the following code for this purpose −
var a = moment([2016, 1]).daysInMonth();
Output
For February in 2016, it displays days as 29.
momentjs_formatting_date_and_time.htm
Advertisements