[AccessD] Age calculation

Gmail max.wanadoo at gmail.com
Tue Jun 26 06:09:48 CDT 2007


Which is exactly why birthdays are good for your health.  The more you have,
the longer you live!

Max
 


Never take life seriously. Nobody gets out alive anyway.
 
 

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of jwcolby
Sent: Tuesday, June 26, 2007 12:00 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Age calculation

The whole argument seems silly.  If you have to wait 365 days to celebrate
your birthday then after your first "leap year birthday", your next birthday
(AND ALL SUBSEQUENT BIRTHDAYS) would be on the first of March.  IOW once
shifted to the first of March, then you always have to wait 365 days after
that so your birthday would be permanently shifted to the first of March!!!
And if you take the argument that "well, once it is on the 1st of March, it
should shift back to February 29th for leap years", then why would not other
people born on March 1st also have to shift back to February 29th?

You were not born on the first of March, you were born on the 29th of
February.  You have to wait 366 days one out of 4 years to celebrate your
birthday, and thus the following year you have to wait 364 days to "make up
for" having to wait the extra day the year before.

In the end, if you live exactly X number of years, your total number of days
alive are the same regardless of when you celebrate your birthday.  I choose
to celebrate my birthday every day since at my age I might not get to my
next birthday.  But in the end, that won't change how long I live.

John W. Colby
Colby Consulting
www.ColbyConsulting.com
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gustav Brock
Sent: Tuesday, June 26, 2007 6:29 AM
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] Age calculation

Hi Susan

> That's not an error -- you can't expect date arithmetic to apply a 
> "business" rule, and frankly, that's what it is. The expression is 
> returning the correct answer, it just isn't the answer you require.

It's not me and it's not a business rule. It's the answer to the question: 
Which date to pick if the date (Feb. 29.) does not exist? The day before or
the day after? 
As the day after falls in a different month, the logical answer is to pick
the day before.
This is exactly what DateAdd() does:

  DateAdd("yyyy", 1, #2/29/2000#) 

which returns 2001-02-28.

And for a reason. You may hear the argument, that a "full year", 365 days,
must pass to be one year older, thus a leapling must pass Feb. 28. for any
year which means Feb. 29 in leap years and Mar. 1. in common years.
However, those people haven't done their home work. Consider these examples
using the expression:

  ? DateDiff("d", d1, d2)

d1 = #1/28/2001#
d2 = #1/28/2002#
Result: 365

d1 = #10/28/2001#
d2 = #10/28/2002#
Result: 365

d1 = #1/28/2000# (leap year)
d2 = #1/28/2001#
Result: 366

d1 = #10/28/2000# (leap year)
d2 = #10/28/2001#
Result: 365

d1 = #2/28/2000# (leap year)
d2 = #2/28/2001#
Result: 366

d1 = #2/29/2000# (leap year)
d2 = #2/28/2001#
Result: 365

d1 = #2/29/2000# (leap year)
d2 = #3/1/2001#
Result: 366

You'll see, that only those born before Feb. 29. in a leap year will have
366 days until their birthday of the following year, while the majority (as
the Oct. example) will have 365 days - as will those of birthday Feb. 29. -
thus nothing indicates why the leaplings should wait one day, increasing the
count of days from 365 to 366, to celebrate their birthday. In fact, the
only argument seems to be a question of personal preference which is
non-arguable and fully valid though useless for business purposes or public
authorities.

> Seems like it would be easy enough to run a simple check -- if it's a 
> Feb 29 birthdate and the date is Feb 28, add 1.

Yes, that's what my function does - of course for common years only.

/gustav

>>> ssharkins at setel.com 26-06-2007 00:39 >>>
That's not an error -- you can't expect date arithmetic to apply a
"business" rule, and frankly, that's what it is. The expression is returning
the correct answer, it just isn't the answer you require. 

Seems like it would be easy enough to run a simple check -- if it's a Feb 29
birthdate and the date is Feb 28, add 1. 

Susan H. 


--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list