Check if a date expired or not

Good afternoon,
I did a small logic that sees if the citizen card date is expired or not. This date is extracted from AS400 terminal.

I built this logic outside the main application and it works fine. But when I implement it does the oposite.

Convert.ToDateTime(strValidadeBISegClienteOutput).ToString > DateNow

Log Output:

2º Cliente | The current date of the Cliente citizen card is: 2030-07-10 the current date is: 2021-08-10

The result is : Invalid Citizen Card→ E Mail sent to the central counter

Any idea in what’s is happening ? any help is appreciated

Thank you!

bring the date string into a dateTime and compare it with expire date as datetime
do it like myDate.Date > myExpireDate.Date

1 Like


Check below for your reference

You can remove .ToString from the convert.Datetime

Hope this helps you


1 Like

Hello ppr!! Thank a lot for your time and effort.

Hello Srini84. Worked as expected… Thank you for your time and effort!

1 Like

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