Date.IsInNextDay

D

T

The M Code Behind the Power Query M function Date.IsInNextDay

Syntax of Date.IsInNextDay Function

The syntax of the Date.IsInNextDay function is as follows:


Date.IsInNextDay(dateTime as any) as logical


The function takes in a parameter called dateTime, which can be any value that can be converted to a date/time value. The function returns a logical value that indicates whether the given date and time value is within the next day of the current date and time.

How Date.IsInNextDay Function Works

The Date.IsInNextDay function works by comparing the given date and time value with the current date and time value. It first converts the given dateTime value to a date-only value by using the Date.FromDateTime function. It then adds one day to the current date and time value by using the DateTime.LocalNow function and the Duration.From function. The result is a date-only value that represents the next day of the current date and time.

The function then compares the given dateTime value with the next day value by using the Date.Compare function. If the given dateTime value is less than the next day value, the function returns true. Otherwise, it returns false.

Examples of Using Date.IsInNextDay Function

Here are some examples of using the Date.IsInNextDay function:

Example 1:


Date.IsInNextDay(#date(2022, 12, 31))


This example returns false because the date value #date(2022, 12, 31) is not within the next day of the current date and time.

Example 2:


Date.IsInNextDay(#date(2022, 12, 1))


This example returns true because the date value #date(2022, 12, 1) is within the next day of the current date and time.

The Date.IsInNextDay function is a handy tool for working with dates and times in Power Query. It allows users to quickly determine whether a given date falls within the next day of the current date and time. By understanding the M code behind this function, users can gain a better understanding of how Power Query works and make the most of its capabilities.

Power Query and M Training Courses by G Com Solutions (0800 998 9248)

Upcoming Courses

Contact Us

    Subject

    Your Name (required)

    Company/Organisation

    Email (required)

    Telephone

    Training Course(s)

    Your Message

    Upload Example Document(s) (Zip multiple files)