Convert SAP date dd.mm.yyyy string to DateTime object

I use a GetText activitie to capture a SAP date in the format dd.mm.yyyy initially as a string object.

But I am unable to convert it to a DateTime object to apply a condition. e.g. Date less than XX days old.

Has anyone been able to convert a SAP date to a DateTime object successfully?

Hello @andrew.pereira use this
Date.ParseExact(variable, “dd.MM.yyyy”, System.Globalization.DateTimeFormatInfo.InvariantInfo)

Thanks Akshay. I also just read another post and got it to work with:

DateTime.ParseExact(stringDate, “dd.MM.yyyy”,Nothing)

What is the difference with Nothing & System.Globalization.DateTimeFormatInfo.InvariantInfo?

This might help you

Thanks again. That was a really good explanation.