Excel - Assign Date Variables

Hey

I have an Excel list and I want to check if the date from column H in the previous month is the date from column G.

To assign the variable “Warenausgangsdatum” I used the Value: Date.ParseExact (row (“Warenausgangs-/Leistungsdatum”) .ToString," dd.mm.yyyy ", System.Globalization.DateTimeFormatInfo.InvariantInfo)

To assign the variable “Buchungsdatum” I used the Value: Date.ParseExact (row (“Buchungsdatum”).ToString," dd.mm.yyyy ", System.Globalization.DateTimeFormatInfo.InvariantInfo)

I created a loop in a For Each Row activity and query there in an If Condition:
Convert.ToDatetime (Buchungsdatum).Month < Convert.ToDatetime (Warenausgangsdatum).Month

But I always get this error:
String was not recognized as a valid DateTime.

Could you please help me to find my error ?

Regards

Hi @RoboticApprentice

You can use Workbook-> Read Range Activity and try your same logic

If it doesn’t work, below link is for your reference

Hope this helps

Thanks

@RoboticApprentice
dd/MM/yyyy this is the correct one, so replace it in both Warenausgangsdatum and Buchungsdatum variables…

@RoboticApprentice
There’re some mistakes

  1. " dd.mm.yyyy " -> it should be “dd.mm.yy”, and please remove the space before dd and after yy

Buchungsdatum and Warenausgangsdatum are DateTime variables so you cannot use
Convert.ToDatetime (Buchungsdatum).Month
Please use Buchungsdatum.Month

@RoboticApprentice Can you please check after reading the Excel File using Read Range, The Value of both Date Column in a Message Box, and Send a Screenshot of it?