[AccessD] Age calculation function

Gustav Brock gustav at cactus.dk
Mon Aug 4 07:46:20 CDT 2003


Hi Bobby

Yes, much clearer. And you may have touched the core of a task like
this - that it is very easy to tell and even show how to do it but the
coding contains a lot of traps.

/gustav


> LOL.

> Sorry, was trying to get out of the office for the weekend.

> What I was saying is that technically, a day is not over until the time has
> reached OVER 24 hours, same for a year.  Looking visually at the calendar,
> 12:00am to 9:00pm is one day.  But if you do the math, it is only 21 hours,
> which is only 75% of a day.

> So, using your dates (03/01/1992-03/01/1987), looking at the calendar, it is
> easy to see that it should be 5 years.  But until you reach that 1st second
> on 03/01/1992, you have not really used up that last full day.  That is why
> my original code did not work.

> Any clearer now?

> Bobby

> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Gustav Brock
> Sent: Saturday, August 02, 2003 5:02 AM
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] Age calculation function


> Hi Bobby

> I tried to think but I'm not quite sure I can follow you. Only newly
> born babies and astrologers care for the time of the day of birth, and
> only children are interested in ages with a resolution of months. And,
> of course, a new day begins at midnight.

> /gustav


>> Good point!  I did not think that you were picking on me.

>> While thinking about this, you technically have to add 0.0001 (may could
>> go smaller) day.

>> Think about it

>> 12/1/99-12/1/99 is technically saying the same as 
>> 12/1/99 12:00am 0 12/1/99 11:59:59pm, which IMHO is not 1 full day until
>> that last second has past (and then it is the next day).

>> When you are using my method, I think that maybe you have to add 0.0001
>> days to get the desired results.

>> I modified the function to take a fraction of a day and entered .0001 as
>> the fraction to add and I get:

>> Debug.Print (Greg2JD("03/01/1992",0)-Greg2JD("03/01/1987",0.0001))/365.25=
>> 5.00205311425984 

>> What do you all think?



More information about the AccessD mailing list