JavaScript

DategetDaysInMonth Method

Syntax

Date.getDaysInMonth()

Returns

daysnumber

The number of day in the month the date is in.

Description

Extension to the native date variable to the get the number of days in the month a given date is in.

Example

var d = new Date(2018,7,10);
var dm = d.getDaysInMonth();
// dm  = 31