Math, asked by AnujPatidar5468, 10 months ago

Age year month and days calculating logic in maths

Answers

Answered by harleenrani86
1

Answer:

Calculating the days elapsed is more of an algorithm of sorts, but the easiest way I'd say would be to do this:

1) Start with your date d/m/y, where the three variables stand for day, month, and year (duh).

2) Calculate the amount of days to the start of the next month (if d=1, ignore this). Depending on the month, this could be 29−d days (if typical february), 30−d days (if leap year february), 31−d days (if 30-day month), or 32−d days (if 31-day month).

3) Calculate the amount of months until New Year's day next year. This should be 12−m, where m is the current month (unless d=1, in which case it's 13−m).

4) Calculate the amount of years until the start of the year of the end date.

5) Add on the amount of months and days from the start of the final date year until the desired date.

6) Do any necessary carry-overs.

Step-by-step explanation:

Here's an example:

Let's compute the amount of days, months, and years between 13/11/2015 and 12/8/2017 (including the start and end).

First, we compute the amount of days until the beginning of the next month after November 13th, which in this case is 18 days.

Then, we compute the amount of months until the beginning of the next year after December 1st, which in this case is a single month.

Now, from 1/1/2016 to 1/1/2017, there is exactly one year.

From 1/1/2017 to 12/8/2017, there are 8 months and 12 days.

This gives a total count of 1 year, 9 months, and 30 days.

Note that you should be careful with month/day overlap; "30 days" could mean a month or not, depending on the month in context.

Similar questions