Difference between two dates in years, months, days
I’ve been searching for a solution to get the difference between two dates in years, months and days like 10th of April 2019 was 2 years, 2 months and 11 days ago, or 12th of Juli 2021 was 0 years, 2 months and 12 days ago. (in reference to current date 24/9/21). I know how to get the amount of years, this should be done by calanderYearsBetween(Date1, CurrentDate), the amount of monts should be something like calanderMonths(Date1, CurrentDate) – (12 * amountOfYears). But I can’t think of something to get the amount of days. Is there any option to calcualte something like this, it needs to be exact...
You will need to follow these steps in a microflow: (Assuming Date1 is the earlier date and Date2 is the latter date)
YY= calendarYearsBetween(Date1, Date2)
DD= daysBetween(Date1C, Date2)
Your solution is YY years, MM months and DD days
If you need a calculation between a date in the past and the current date, try out the Formatstring widget which has this feature included with translatable strings.
More info: https://docs.mendix.com/appstore/widgets/format-string#translatable-strings