DateTime.IsInCurrentMinute

Updated on

DateTime.IsInCurrentMinute is a Power Query M function that indicates whether the provided date(time) value occurs during the current minute, as determined by the system.

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

Syntax

DateTime.IsInCurrentMinute( dateTime as any ) as nullable logical

Description

DateTime.IsInCurrentMinute indicates whether the given dateTime argument (which can be of type datetime or datetimezone) occurs during the current minute, as determined by the current date and time on the system.

Examples

Let’s explore two examples to understand how the DateTime.IsInCurrentMinute function works.

Checking DateTime Values for the Current Minute

Suppose you have a table with DateTime values and you want to add a column that shows true for DateTime values that fall within the current minute. You can do this by using the DateTime.IsInCurrentMinute function on your [DateTime] column.

DateTime.IsInCurrentMinute( [DateTime] ) // Output depends on [DateTime] column

This expression returns true for any DateTime values in the [DateTime] column that fall within the current minute.

If the current time is 09:59:46 PM on July 7, 2024, this function will return true for all rows with DateTime values between 09:59:00 PM and 09:59:59 PM.

Here’s a screenshot to illustrate how the DateTime.IsInCurrentMinute function works with a DateTime table:

Example of how to use the DateTime.IsInCurrentMinute Function in Power Query M

In this example, the DateTime values increment by 15 seconds for each row. The column IsInCurrentMinute shows true for the four DateTime values that fall within the current minute.

Using the Current Date and Time

If you want to check with DateTime.IsInCurrentMinute if the current date and time falls within the current minute, you can do that using the DateTime.FixedLocalNow function:

// Output: true 
DateTime.IsInCurrentMinute(
  DateTime.FixedLocalNow()
)

Other functions related to DateTime.IsInCurrentMinute are:

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

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