Date.Day

Updated on

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.

Date.Day returns the day portion of a date value in Power Query M

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.

Learn more about Date.Day in the following articles:

Learn more about Date.Day in the following articles:

Other functions related to Date.Day are:

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

2023-2024 © BI Gorilla. All rights are reserved. Information from Microsoft docs is property of Microsoft Corp. | Privacy Policy