Let's say for example my birthday is August 17, 1996. Each year has 365 days except leap years. If I didn't know whether 1996 was a leap year or not, is there a way I can see how many days I've been alive (obviously without looking at a calendar or manually counting). And from my birthdate, how can I (if possible) deduce what today's date is?
If I wanted to determine today's date based on my birthdate, how could I do that mathematically?
112 Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail AtThere are 4 best solutions below
On
I don't know if this is an acceptable answer, but you can do 1) An SQL Server query using the DateDiff function, a "" function with inputs ( DatePart, Date 1, Date 2) where DatePart is the "Gradation" : Years, Months, Days, etc.
Select DateDiff( Days, Date1, Date2) , where Date1 is your DOB, Date2 is the date for which you want to find the number of days passed. You can run it for free here: https://www.w3schools.com/sql/func_datediff.asp
OR 2) Use a perpetual calendar https://accuracyproject.org/perpetualcalendars.html: There are 14 possible day arrangements for a calendar: Once the date of January 1st and whether the year is a leap year or not, the calendar is determined : Jan 1st can fall on Mon through Sunday , and the year is either leap or non-leap. Just look up the year number and look up the calendar for that year.
On
If you want to be able to do that in your head, then you'd start by working out the number of the day of both dates (as in, January 2nd would be day #2, December 30th in a non-leap year would be day #364, etc.).
You can do this fairly quickly by memorizing the number of days that occur prior to each month in a non-leap year.
Before January, there are 0 days.
Before Februrary, there are 31 days.
Before March, there are 59 days.
Before April, there are 90 days.
Before May, there are 120 days.
Before June, there are 151 days.
Before July, there are 181 days.
Before August, there are 212 days.
Before September, there are 243 days.
Before October, there are 273 days.
Before November, there are 304 days.
Before December, there are 334 days.
These amounts of days are easy to memorize. All of them, not surprisingly, are close to their month number (January = 1, February = 2, etc.) minus 1 times 30. For leap years, of course, just add 1 to every month from March to December.
Using your example of August 17th, 1996, you'd first need to realize that 1996 is a leap year. Before August, there are 212 days before it, plus 1 for the leap day, making 213 days. Naturally, this makes August 17th, 1996 the 230th (213 + 17 = 230) day of the year.
As I write this, it's July 27, 2017, so let's figure out when the next July 27th would be after your start date. That would be July 27th, 1997. July 27th is the 208th day of the year (181 days before July, plus 27 days in July).
From the 230th day of a leap year to the end of the year (the 366th day) is 136 days. Adding another 208 days to that gives us 344 days between the 2 dates.
So, from August 17th, 1996 to July 27, 1997 is 344 days. July 27th, 2017 is 20 years after that, so if you desired, you could simply state that it's been exactly 20 years and 344 days since August 27, 1996.
To count the total number of days, you'd have to multiply 365 by 20 (which is 730 × 10 or 7300 days). Finally, you'd have to add 1 for each leap year between the 2 dates: 2000, 2004, 2008, 2012, and 2016. You get 7300 + 5 + 344 = 7649 days between the 2 dates. (Wolfram|Alpha calculation)
Of course, you'd have to practice enough to become comfortable with multiplying 365 times various integers to use this latter approach.
On
There is a very simple solution (assuming that you can use programs) : convert dates to Julian days and subract the two numbers.
For example, in the book "Numerical Recipes" you could find a subroutine named julday.
You also could find a source code here.
For example, today $(07/28/2017)$ is $2457963$ and your birthday $(08/17/1996)$ is $2450313$ which makes a difference of $7650$.
You can use the method for any other situation.
I wrote a small program (I am a beginner programmer, so it may not be a very efficient way of doing this) to compute the number of days passed between two dates. One would enter the first date in the form D/M/Y and then the second in the same form, and this will spit out the number of days in between. I used C++.
I create functions to count the number of days produced by the number of years, months, and then days of each date. Then I subtract the two numbers obtained from each date to obtain the number of days passed between the two dates. The number of days for the months is $31$ if it is February, for instance (i.e. if someone inputs 2 as the month, then $31$ days have passed since the beginning of that year until this month). The only tricky part is with leap years, in which a leap year occurs if $$(4\mid y~\land~100\nmid y)\lor(400\mid y)$$where $y$ denotes the year.
For your birthdate: August 17, 1996, we would input 17/8/1996 as the start date, and then today's date as the end date (the day I posted this is 30/7/2017). On the day I posted this, you would be $7652$ days old.