English

The DAYSINMONTH function returns the number of days in a month you specify.

For example, you can use DAYSINMONTH to check if a leap year occurs in February, so you can plan accordingly.

DAYSINMONTH(Year, Month)

Arguments

ArgumentData typeDescription
YearNumberThe year that contains the month to determine the number of days within.
MonthNumber

The month to determine the number of days within.

Should be a number between 1 and 12 (the function returns a value of 0 for numbers outside this range).

The DAYSINMONTH function returns a numeric result.

Syntax Example

DAYSINMONTH(2024, 2)

This example returns the number of days in February 2024. This is 29, as 2024 is a leap year.

Constraints

The DAYSINMONTH function returns a value of zero for any values outside of the date range of 01/01/1900-12/31/2399.

Excel equivalent

EOMONTH

Examples

FormulaDescriptionResult
DAYSINMONTH(2023, 1)Returns the number of days in January 2023.31
DAYSINMONTH(2023, 2)Returns the number of days in February 2023.28
DAYSINMONTH(2024, 1)Returns the number of days in January 2024.31
DAYSINMONTH(2024, 2)Returns the number of days in February 2024.29

Disclaimer

We update Anapedia content regularly to provide the most up-to-date instructions.