0065. If you were asked to convert 52,897,605 seconds to years, months, days, hours and seconds (assume 30 days per month), how would you do it?
We know there are:
60 seconds in a minute
60 minutes in an hour
24 hours in a day
30 days in a month
12 months in a year
Again, we must collect in reverse order:
52,897,605 % 60 = 45 <= The (remaining) number of seconds
52,897,605 / 60 = 881626 <= The total number of minutes
881626 % 60 = 46 <= The (remaining) number of minutes
881626 / 60 = 14693 <= The total number of hours
14693 % 24 = 5 <= The (remaining) number of hours
14693 / 24 = 612 <= The total number of days
612 % 30 = 12 <= The (remaining) number of days
612 / 30 = 20 <= The total number of months
20 % 12 = 8 <= The (remaining) number of months
20 / 12 = 1 <= The number of years
52,897,605 seconds is 1 year, 8 months, 12 days, 5 hours, 46 minutes and 45 seconds