.ToDateTime("mm/dd/yyyy") not working properly


I am trying to convert a date which I pull from SAP using get text into a generic value variable called lv_ValidEndDate. I then try to convert into a real date value so I can compare with today’s date

lv_ValidEndDate_real = lv_ValidEndDate.ToDateTime(“mm/dd/yyyy”)

I found that lv_ValidEndDate gets a date like ‘10/31/2020’, it’s been converted to date as 1/31/2020 which makes it earlier than today’s date Hence doing this in if activity:

lv_ValidEndDate_real <= lv_Today_real

tells me that lv_ValidEndDate_real earlier but it’s supposed to be later than today. How do I correct the syntax to enable an accurate conversion to date value?

Hy @Lucky_Bodemeh,

Try MM for the month instead of mm. Please let me know if it works.



Hi Lucky_Bodemeh,

Try this method to convert date as ‘1/31/2020’


Hope this may help you

This change worked! Thanks a lot

Changing from mm to MM and using the syntax you indicated here works got me the desired result.

Hy @Lucky_Bodemeh,

I am very gald I could help you.

Please like my post and mark my answer as a solution, it helps me .