Given a positive integer input n
seconds, output the time in human readable format.
The time will be considered from 00:00:00, 1st January, 1 A.D.
Leap years must be taken into account.
Assume that the gregorian calendar was followed since the beginning.
(Gregorian Calendar: Every year that is exactly divisible by four is a leap year, except for years that are exactly divisible by 100, but these centurial years are leap years if they are exactly divisible by 400. For example, the years 1700, 1800, and 1900 were not leap years, but the years 1600 and 2000 were)
Output must be a string of the format:
x Millennia/Millennium, x Centuries/Century, x Decades/Decade, x Years/Year, x Months/Month, x Days/Day, x Hours/Hour, x Minutes/Minute and x Seconds/Second
The 0 values must not be shown.
Program must handle at least up to 999 Millennia(inclusive).
Plural/Singular must be kept in mind.
(For millennium, both millennia and millenniums are valid)
,
,and
and spaces must also be kept in mind.
Case may be anything.
Examples:
1:1 second
2:2 seconds
60:1 minute
62:1 minute and 2 seconds
3600:1 hour
3661:1 hour, 1 minute and 1 second
31536001:1 year and 1 second
317310301:1 decade, 20 days, 13 hours, 45 minutes and 1 second
3499454714:1 century, 1 decade, 10 months, 22 days, 22 hours, 45 minutes and 14 seconds
73019321114:2 millennia, 3 centuries, 1 decade, 3 years, 10 months, 22 days, 45 minutes and 14 seconds
Reference: date-difference to duration converter
This is code-golf so shortest code wins