How to get the number of years, months and days between two dates?

I am creating an application where I want to display the number of years, months and days between 2 dates.
01 Jan 2022
05 Mar 2022
0 Y 2 M 4Days

Why don’t you try this extension?

Convert the dates into millis and use this extension

Thank you, but I dont want to use the extension. Is it not possible with date_picker or CLock modules?

you can get it, no issue but need to add more blocks… the logic is, get millis between two dates or count days between the two and convert the result number into as per your requirement

simple approach, remaining you can alter

If the remainder value is greater than 30 than divide it by 30 and set the remainder of this division as date… like this you can get Years,Months and days between two dates without extension ( one among from multiple way of approach)

Thank You, I think this will work for my requirement.

1 Like

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