Condition issue

can you tell me why it’s going into the else part if my date is less than the condition date. see what on the right side result tab.

@lakshman @amarasto @Palaniyappan

Can you tell me what is the variable type (Joining date) there you are using @balkishan

Hey @balkishan,

For date comparison use

Less than zero : If t1 is earlier than t2.
Zero : If t1 is the same as t2.
Greater than zero : If t1 is later than t2.

1 Like


Convert it to datetime and use datetime.comapre method

sorry didn’t get bro

So, you need to convert it to the format date first and then try using compare class as @amarasto said in the earlier post.

Or the second option is give the date within the strings and then try.

Credits to : @amarasto

1 Like

this JoiningDate is a string type variable. which extract the value from the doc. and I just compare it with the given condition. can you please tell me how to convert it to datetime.comare…

Convert.Todatetime(joiningdate, “DD/MM/YYYY”) @balkishan

1 Like,Convert.ToDateTime(“25/12/2019”))


Thanks @amarasto @HareeshMR it’s worked when I taken in a string.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.