Date.Day is a function in the Power Query M language that returns the day component of a date, datetime, or datetimezone value.
Compatible with: Power BI Service Power BI Desktop Excel Microsoft 365
Syntax
Date.Day( dateTime as any ) as nullable number
Description
Date.Day
extracts the day component from a provided dateTime
(date, datetime, or datetimezone).
Examples
The Date.Day
function works with date
, datetime
, and datetimezone
values.
Extracting the Day for a Date Value
When you apply the Date.Day
function to a date
value, it returns the day of the month for that date. For example, to find the day of the month for June 15, 2024:
// Output: 15
Date.Day( #date( 2024, 6, 15 ) )
This expression returns 15, as June 15th is the 15th day of the month.
To visualize this, imagine a table with a date column containing multiple date values. You can extract the day of the month for each date by using Date.Day
.
Extracting the Day for a DateTime Value
The function also supports datetime
values. To find the day of the month for a datetime value of June 30th, 2024, 12:00 AM:
// Output: 30
Date.Day( #datetime( 2024, 6, 30, 0, 0, 0 )
This expression returns 30, as June 30th is the 30th day of the month.
Extracting the Day for a DateTimeZone Value
Similarly, applying the function to a datetimezone
value returns the day of the month for that datetimezone:
// Output: 17
Date.Day( #datetimezone( 2024, 6, 17, 0, 0, 0, 1, 0 ) )
This expression returns 17, as June 17th is the 17th day of the month.
Related articles
Learn more about Date.Day 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 articles
Learn more about Date.Day 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.Day are:
- Date.DayOfWeek
- Date.DayOfYear
- Date.DaysInMonth
- Date.Month
- Date.QuarterOfYear
- Date.WeekOfMonth
- Date.WeekOfYear
- Date.Year
2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy