DateTime.IsInNextNHours

This function determines if the specified datetime value dateTime falls within the next number of hours based on the current date and time of the system. It should be noted that the function will retu...

Syntax

DateTime.IsInNextNHours(dateTime as any, hours as number) as nullable logical

About

This function determines if the specified datetime value dateTime falls within the next number of hours based on the current date and time of the system. It should be noted that the function will return false if a value falls within the current hour. Inputs for the function include dateTime (a datetime or datetimezone value to be evaluated) and hours (the number of hours to be considered).

Explanation

Verify whether the time one hour after the current system time falls within the next two hours. Power Query Formula: MDateTime.IsInNextNHours(DateTime.FixedLocalNow() + #duration(0, 2, 0, 0), 2) Result: True