Get the date difference


I have an excel which has a column where it consists of dates with the format d.MM.yyyy.

So for example 15.01.2020

What I want is read cell and get the day difference with todays date. so that I can create an if function to move forward according to the date difference.

Any suggestions?
I appreciate every bit of help.

Hey @berkaykor

This link will solve your query How To Find The Date Difference(Days, Months and Years) – In UiPath – ExcelCult

Mark it as a solution if it helps.

1 Like

What should be the variable type for date1 and 2
I get this error:
Message Box: String was not recognized as a valid DateTime.


Can you share the screenshot of your flow?


Test with DateTime.ParseExact() instead. Convert.ToDateTime() uses the CultureInfo.CurrentCulture which is probably expecting the month before the date.

DateDiff(DateInterval.Day, DateTime.ParseExact("15.01.2020", "dd.MM.yyyy", System.Globalization.CultureInfo.InvariantCulture), DateTime.Now).Tostring

Or in your case:

DateDiff(DateInterval.Day, DateTime.ParseExact(date1, "dd.MM.yyyy", System.Globalization.CultureInfo.InvariantCulture), DateTime.Now).Tostring

Let me try.

Worked very well. thank you.
I just changed dd.MM.yyyy to d.MM.yyyy because sometimes the dates are given as 6.11.2020 rather than 06.11.2020.

Thank you very much

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.