DateTime.IsInPreviousNSeconds
This function determines if the specified dateTime value occurs within the past number of seconds based on the current system date and time. It should be noted that the function will return false if a...
This function determines if the specified dateTime value occurs within the past number of seconds based on the current system date and time. It should be noted that the function will return false if a value within the current second is passed as an argument.
Parameters:
- dateTime: A datetime or datetimezone value to be checked.
- seconds: The number of seconds to compare against.
Check if the time one second before the current system time falls within the two seconds before it. The function MDateTime.IsInPreviousNSeconds is used in Power Query to carry out this calculation, by subtracting 2 seconds from the current local time using DateTime.FixedLocalNow() and then checking if the result falls within the previous 2 seconds. The output of this operation is 'true'.