First of all we need two dates to calculate age. The first date will be an example birth date (e.g.: 08/26/1979, 09:45:07), while the second date is (02/10/2010, 18:52:00) the original date of this article.
AGE CALCULATION
Age calculation starts from calculating the seconds difference, followed by minutes, hours, days, months and year difference at the end. As with every calculation we start the subtraction from the most right unit (seconds in this case) and step by step going to the left we will subtract the adequate data. If we have insufficient minuend, we borrow one leftward unit and increase the actual minuend by the leftward unit converted to minuend.
For example (in our case): if we calculate the minutes or hours, we simply subtract 45 from 52 and 9 from 18 which is 7 and 9, but if we want to calculate the seconds, we will have insufficient seconds as minuend for subtraction.
In this case we will borrow 1 minute from the minutes and convert it to seconds. Now we have a date (02/10/2010 18:51:60), where seconds subtraction is possible. The difference will be 53 seconds and because we borrowed one minute, the minutes difference will change from 7 to 6 (18:51:60 - 09:45:07 = 09:06:53). The hours difference stays unchanged as we did not borrow any hours previously. The day calculation also has insufficient minuend and now we will borrow a month. Months are unique in this formula, because they do not have fixed maximum values. For this calculation we will examine the August month. August has 31 days. The difference between 08/26 and the 1st of the next month is 5 days. Our example date is 02/10, so the day difference between the two dates is 15 (5 days from August and 10 days from February). We'll do this exact calculation with the months also, where we'll borrow a year. The difference will be 5 (2 - 1 (the one borrowed month) + 12 - 8 is 5). With the final subtraction of the year (2010 - 1980 (1979 + one borrowed year) = 30) we have the difference between two dates, which is 30 years, 5 months, 15 days, 9 hours, 6 minutes, 53 seconds.