Date.DaysInMonth

Updated on

Date.DaysInMonth is a Power Query M function that returns the number of days in the month in the date, datetime, or datetimezone value. The function returns the number of days in the month as an integer.

Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365

Syntax

Date.DaysInMonth( dateTime as any ) as nullable number

Description

Date.DaysInMonth calculates the number of days in the month of the given date, datetime, or datetimezone value (dateTime). It returns a number between 28 and 31, reflecting the month’s length in days.

Examples

Number of days in the month December as represented by #date( 2011, 12, 01 )>.

// Output: 31
Date.DaysInMonth( #date( 2011, 12, 01 ) )

Learn more about Date.DaysInMonth in the following articles:

Other functions related to Date.DaysInMonth are:

BI Gorilla Youtube Channel

Contribute » | Contributors: Rick de Groot
Microsoft documentation: https://learn.microsoft.com/en-us/powerquery-m/date-daysinmonth