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


#1

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?


#2

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


#3

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?


#4

This might help you


#5

Thanks again. That was a really good explanation.