I have numbers that represent seconds. I want to know how I should get years, months, and days of it in Javascript. for example, X second means five years and six months, and 22 days how I should write a code that gets these from the second I gave.
Asked
Active
Viewed 51 times
1
-
1this old thread will surely help you out : [good luck](https://stackoverflow.com/a/25279340/17024672) – Hen Moshe Feb 14 '22 at 17:55
-
@nEo please use the link Hen Moshe provided, this is a very common question and that link will point you in the best direction. – Andy Donegan Feb 14 '22 at 18:00
-
2Does this answer your question? [Convert seconds to HH-MM-SS with JavaScript?](https://stackoverflow.com/questions/1322732/convert-seconds-to-hh-mm-ss-with-javascript) – Andy Donegan Feb 14 '22 at 18:02
-
1The answer will be an approximate number of years, months, and days because the number of seconds in a year depends if the year is a leap year or not; also the number of seconds in the month of Feb will be different than that in March. – Mohsen Alyafei Mar 02 '22 at 05:41