# Birthdate differences calculation relative to earths orbit duration

I have got a question as I am trying to figure out what the real difference between the birth date of my friend and me is.

I am born on 1983 6th February 7 am. My Friend is born on 1984 7th February 1 am. 1982 was a leap year as the real duration of earths orbit around sun is ca. 365 1/4 days. Okay... But I am struggling to figure out if need to add/subtract 8 hours to my or my friends birthday to figure out what the real difference in our birth dates is, in relation to how long earth orbits around the sun. That leap year is at end of February makes it even harder to me as I don't know how that fits in into the calculation.

• I think that is the purpose of leap year. To average out the difference in the length of the year. So, I think (not sure) that you need to subtract the 1/4th day from your age. – Yashbhatt Sep 3 '14 at 15:49
• It's not clear (to me, at least) just what you mean by "the real difference in our birthdates ... relation to how long earth orbits around sun". Are you trying to express the difference in sidereal years? If so, I'll delete my answer. – Keith Thompson Sep 3 '14 at 23:10
• Since birth times are recorded in calender time rather than sidereal or orbital times, you simply take the difference in calender times: You are 365 days (since 1938 was not a leap year) and 18 hours older than your friend. – Walter Sep 6 '14 at 9:32

The sidereal year is 6 hours and 9 minutes longer than a 365 day calendar year. To simplify your question, assuming you an your friend were born on the same date and time in 1983 and 1984 you would be 365 days, 6 hours, and 9 minutes older than your friend.

Since there is no leap day between the two times you are considering, it doesn't affect the calculation.

• The dates given are calendar dates, and there are no intervening leap days, so the 6 hours and 9 minutes doesn't apply. And by simplifying the question, you're not really answering it. If two people are born on the same calendar date and time in 1983 and 1984, then their ages differ by exactly 365 or 366 days, depending on whether the leap day 1984-02-29 is between their birth dates. – Keith Thompson Sep 3 '14 at 22:40
• The question specified "in relation to how long earth orbits around sun" which is not a calendar year. If your answer is the correct interpretation, this question is inappropriate for this SE. – Aaron Sep 3 '14 at 23:07
• Yes, but the birth dates were expressed in calendar days. I've added a comment asking for clarification. – Keith Thompson Sep 3 '14 at 23:11
• The wording of the question doesn't affect the answer, since, as @KeithThompson noted, the birthdates are calendar dates, and each calendar day does last 24 hours. The only difference would be if the OP asked for an answer given in a fraction of orbits around the sun, or sidereal years... – Etienne Pellegrini Sep 3 '14 at 23:49

I'll use YYYY-MM-DD notation.

You were born 1983-02-06 07:00.

Your friend was born 1984-02-07 01:00.

There was no leap day between your birthdays, which makes the calculation a little simpler. The most recent leap day before your birthday was 1980-02-29; the earliest leap day after your friend's birthday was 1984-02-29. (No, 1982 was not a leap year, and even if it had been that leap day still wouldn't have been between your birthdays).

The moment exactly one calendar year after your birthday was 1984-02-06 07:00; that calendar year is exactly 365 days. Your friend was born 1 day minus 6 hours after that moment. So the difference between your births is 365 days plus 1 day minus 6 hours, or 365 days, 18 hours (365.75 days).

And here's a bash script that computes the results:

#!/bin/bash

date0='1983-02-06 07:00'
date1='1984-02-07 01:00'

# Compute date as seconds since 1970-01-01 00:00:00 UTC
seconds0=$(date +%s -d "$date0")
seconds1=$(date +%s -d "$date1")

# Do some math.  Note that this does only integer arithmetic.
# It happens to work in this case since we're dealing with whole
# hours, but this is not a general solution.
(( seconds = seconds1 - seconds0 ))
(( days      = seconds / 86400 ))
(( hours = seconds % 86400 / 3600 ))

# Show the results.
echo "$date0 =$seconds0"
echo "$date1 =$seconds1"
echo "The dates differ by $seconds seconds or$days days and \$hours hours"


The output is:

1983-02-06 07:00 = 413391600
1984-02-07 01:00 = 444992400
The dates differ by 31600800 seconds or 365 days and 18 hours