Check a date falls between two dates

Hey guys,

I have all my dates as string,

I have this inside the condition of an if statement
(DateTime.ParseExact( ReconcillationDateTimeStamp, “ddMMMyyyy”, Nothing) >= DateTime.ParseExact( CompStartDate, “ddMMMyyyy”, Nothing)) AndAlso ( DateTime.ParseExact( ReconcillationDateTimeStamp, “ddMMMyyyy”, Nothing) <= DateTime.ParseExact( CompStartDate, “ddMMMyyyy”, Nothing) )

But it doesn’t work for me

I also used it in an invoke code

If ((TransactionItem >= CompStart) AndAlso (TransactionItem <= CompEnd)) Then
Console.WriteLine(“between”)
out_Between = True
Else
Console.WriteLine(“not between”)
End If

yet it still doesnt work

I can trying to return true if a date falls between two date ranges .

All my dates are in string that was why i had to convert them.

Please help

Regards

Check this below link, @David_Oku


Hope this may help you :slight_smile:

@David_Oku Can you provide the String date values that you have used ?

Heyy thanks @supermanPunch checking if 19JUN2020 is btwn ,17JUN2020 and 20JUN2020

@David_Oku Have you hard coded the values and checked with it ?

@David_Oku And as I have noticed you’re using only two variables, shouldn’t there be three variables to compare them, Like CompStartDate and CompEndDate ?

Oh now it worked … i took it into a separate workflow and it worked, I think i must have declared duplicate variables in the main sequence, so i cleared unused variables and added it back… now it works fine. Thanks @supermanPunch

1 Like