How to check whether specific date comes in within defined date range


I am trying to find whether any date comes between specific date range or not.
Ex. In Below screenshot want to check whether Validity_Start_Date is comes in-between Effective_Date and End_Date.

I have put below logic, but not getting desired output.
Effective_Date>=Validity_Start_Date and Validity_Start_Date>=End_Date

are you getting any error?

No Error, but not getting correct output

use DateTime.ParseExact( urdatestring, “MM-dd-yyyy”, Nothing)
and then do the comparison

Convert your variable types to DateTime and Than Do Comparison Operation.
Try This Expression
Effective_Date<=Validity_Start_Date and Validity_Start_Date<=End_Date

Hope it helps.


Based on your screenshot, you are comparing String instead of Date Type. You are allowed to compare strings but the result may be different from your expectation. You have to convert string to Date type before doing comparison.

1 Like