How to calculate the length of a date to the present date

Hi All,

I need to find out how many months and years are between a specific date and the present date. For example, this is the format of the date July 16, 2019 to the present date. I need to calculate how many months and years there are in the difference. The date will change so I would need a dynamic expression to work.

Thank you!

@Lisa_O
Find starter help here:
CalcDiff_YearMonthTotalMonth.xaml (6.0 KB)

Parsing this format can be done as below:

DateTime.ParseExact("July 16, 2019","MMMM dd, yyyy", CultureInfo.InvariantCulture)
1 Like

Hi, thank you for your response.

When trying to use DateTime.ParseExact(strDate, “dd.MM.yyyy”, CultureInfo.InvariantCulture) I am getting the following error message, ‘CultureInfo’ is not declared. Would you know the reason why I am getting this?

Thank you!

@Lisa_O
ensure following:
grafik

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