[AccessD] Age calculation

Lembit Soobik lembit.dbamail at t-online.de
Mon Jun 25 09:52:44 CDT 2007


Gary,
isnt the rule that if born on Feb-29, your birthday is on Feb-28 on non-leap 
years?
Lembit

----- Original Message ----- 
From: "Gary Kjos" <garykjos at gmail.com>
To: "Access Developers discussion and problem solving" 
<accessd at databaseadvisors.com>
Sent: Monday, June 25, 2007 4:17 PM
Subject: Re: [AccessD] Age calculation


>I think that is the right answer myself. A person born on 2/29/1992 is
> not 5 until 3/1/1997. On 2/28/1997 they are still 4 aren't they?
>
> GK
>
> On 6/25/07, Gustav Brock <Gustav at cactus.dk> wrote:
>> Hi Steve
>>
>> Sorry, it still fails miserably for, say, these dates:
>>
>> DOB = #2/29/1992#
>> AtDay = #2/28/1997#
>>
>> returning 4 and not 5.
>>
>> /gustav
>>
>> >>> miscellany at mvps.org 23-06-2007 22:57 >>>
>> Hehe.  Answering my own question.  I wouldn't mind $5 for every time I
>> have used that expression over the last 12 years, on the assumption that
>> I had it licked.
>>
>> And now I see the obvious - in the case of a 29 February birthday,
>> evaluating age on 28 February in a non leap year works correctly, but
>> evaluating age on 28 February during a leap year, it gives the wrong 
>> figure.
>>
>> So, I have modified accordingly...
>>
>> Age: DateDiff("yyyy",[DOB],[DateAt])+(Format([DOB]+(Format([DOB],"mmdd")
>> =Format([DateAt],"mmdd")="0229"),"mmdd")>Format([DateAt],"mmdd"))
>>
>> Regards
>> Steve
>>
>>
>> Steve Schapel wrote:
>> > However, I can't find an example where the following does not work
>> > correctly.  Can you?
>> >
>> > Age: 
>> > DateDiff("yyyy",[DOB],[DateAt])+(Format([DOB]+(Format([DOB],"mmdd")
>> > ="0229"),"mmdd")>Format([DateAt],"mmdd"))
>> --
>>
>>
>> --
>> AccessD mailing list
>> AccessD at databaseadvisors.com
>> http://databaseadvisors.com/mailman/listinfo/accessd
>> Website: http://www.databaseadvisors.com
>>
>
>
> -- 
> Gary Kjos
> garykjos at gmail.com
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>
>
> -- 
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.472 / Virus Database: 269.9.6/865 - Release Date: 24.06.2007 
> 08:33
>
> 




More information about the AccessD mailing list