How to check if a date is between two dates in Power Automate
This post shows an example of how you can check if a date is less than or more than a specific date or within a time period.
A sample use case can be for instance a to check if a case must be followed up in between a time period, a start and end date. For instance when a case is created in Dynamics 365 and you have an SLA that the case must be responded to within a time period. Than you can check on the created date and a deadline for the response. If it’s overdue a notification can be sent to the service user.
How the flow works
The flow consists of thee variables startDate, endDate and currentDate. Each of the variables is set with different date values.
In the startDate variable I use an expression that subtract 5 days from the current date to simulate a start date.
In the endDate variable I use an expression that adds 5 days from the current date to simulate an end date.
In the currentDate variable I use an expression to get todays date.
In the condition step I uses an expression that checks if currentDate is greater than startDate and less than endDate. If the expression returns true the current date is in between startDate and endDate and the condition returns true.
The flow then continues to the “if yes” step where the date variables are outputted in a compose for test purpose.
Further in the post there are examples of different results by adding and removing days to the currentDate variable as can be seen in the screenshots further down.