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
Returns the number of days in the month in the date
, datetime
, or datetimezone
value dateTime
.
dateTime
: Adate
,datetime
, ordatetimezone
value for which the number of days in the month is returned.
Examples
Number of days in the month December as represented by #date( 2011, 12, 01 )>
.
// Output: 31
Date.DaysInMonth( #date( 2011, 12, 01 ) )
Related articles
Learn more about Date.DaysInMonth in the following articles:
- Create Date Table or Calendar in Power Query M
Learn how to create a dynamic calendar table in Power Query’s M language. Build your custom columns and claim your free Date Table Script. » Read more
Related functions
Other functions related to Date.DaysInMonth are:
- Date.Day
- Date.DayOfWeek
- Date.DayOfYear
- Date.Month
- Date.QuarterOfYear
- Date.WeekOfMonth
- Date.WeekOfYear
- Date.Year
