Comparing two dates error


I have a problem with comparing two dates. I am trying to compare mailreveivedtime and mailLastReadingTime in condition with > and then I tried to compare these two dates with CompareTo but it also does not work

Please, can somebody help me? Thanks


CompareTo return value -

  • Less than zero : If this instance is earlier than value.
  • Zero : If this instance is the same as value.
  • Greater than zero : If this instance is later than value.


you can use
DateVariable1 >= DateVariable2

returns Bool Value

I tried that but I always get -1 as result.


Are both of your variables DateTime ?
If yes, try and use DateTime.Compare like this:
DateTime.Compare(mailreceivedtime, mailLastReadingTime);

In attachment is project. Maybe the problem is with reading values…

Email_and_attachment_parser.xaml (16.5 KB)
Last_reading_time.xlsx (9.1 KB)

Hi guys, everything is working when I store this value in *txt file…

Please refer to this one: Unable to compare date

1 Like