Transform the seconds retained from Time.subtract() back into Years, months, days, hours, minutes, seconds

Former Member
Former Member

Hello everybody,

I can now calculate the difference between two dates in seconds with help of the subtract method:

https://developer.garmin.com/connect-iq/api-docs/Toybox/Time/Moment.html#subtract-instance_function

But I struggle a lot with transforming this result back into a human-readable date.

My favorite result would be:
years, months, days, hours, minutes, seconds

For now, I tried to calculate it with modulo and floor, but all my results are far off. I would be very thankful for all your suggestions. Possibly there is even an existing method to get these results?

Thank you for your time and effort in reading (and maybe replying) to my question!