Bobby Heid
bheid at appdevgrp.com
Fri Aug 1 13:37:16 CDT 2003
Why not convert both to Julian dates and then divide by 365.25? This will give you years as a decimal number. In your example: (jd("02/18/2002") - jd("02/29/1988")) / 365.2 =(2452323.5 - 2447220.5)/365.25 =5103 /365.25 =13.9712525667351 years If anyone is interested in the code to do this, let me know and I'll post it. Bobby -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Gustav Brock Sent: Friday, August 01, 2003 1:49 PM To: Access Developers discussion and problem solving Subject: Re: [AccessD] Age calculation function Hi Mark > Are you saying 14 and 31 are correct or incorrect? I would think they are > correct. If so, using DateDiff with "m" and dividing by 12 will work. I > think you're saying those values are correct, but if not, I'm confused. No no, I say those values are correct. But I don't quite understand the month-thing ... it will fail in about 50% of any calculation as it doesn't take the day into account: #02/29/1988#, #02/18/2002# should return 13, not 14. I've heard of a couple celebrating their 25 year wedding day 24 years after their wedding because the wife couldn't count to 25. That is just fun - they can celebrate it once again at the real date - but for business applications dealing with pensions, salaries, holidays etc. getting the wrong age or employment period is mandatory and you have to use reliable calculation methods. /gustav >> You may wish to look up "Age Calc" in the archives around Okt. 2002. >> >> Many of the "smart" suggestions will fail for date intervals like: >> >> #03/01/1988#, #03/01/2002# >> is 14 >> >> #03/01/1968#, #02/28/2000# >> is 31 _______________________________________________ AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com