PC Review


Reply
Thread Tools Rate Thread

Calculating age from current date-DOB

 
 
=?Utf-8?B?UCBOYWhzZXI=?=
Guest
Posts: n/a
 
      10th Oct 2006
I'm trying to display someones age using (date ()-DOB)/365 but I get years
with a decimal ( ie 76.7 years). If I change the format to "fixed" and set
the decimal places to "0" then it rounds up the age ( ie 77 years) How can I
display just 76 which is the more conventional way we talk about age.
 
Reply With Quote
 
 
 
 
=?Utf-8?B?U3ByaW5rcw==?=
Guest
Posts: n/a
 
      10th Oct 2006
See the following link:

http://office.microsoft.com/en-gb/as...550711033.aspx

Sprinks

"P Nahser" wrote:

> I'm trying to display someones age using (date ()-DOB)/365 but I get years
> with a decimal ( ie 76.7 years). If I change the format to "fixed" and set
> the decimal places to "0" then it rounds up the age ( ie 77 years) How can I
> display just 76 which is the more conventional way we talk about age.

 
Reply With Quote
 
ruralguy via AccessMonster.com
Guest
Posts: n/a
 
      10th Oct 2006
Maybe this will help.

Public Function Age(DOB As Date) As Integer

Age = DateDiff("yyyy", DOB, Date) + (Date < DateSerial(Year(Date), Month(DOB),
Day(DOB)))

End Function


P Nahser wrote:
>I'm trying to display someones age using (date ()-DOB)/365 but I get years
>with a decimal ( ie 76.7 years). If I change the format to "fixed" and set
>the decimal places to "0" then it rounds up the age ( ie 77 years) How can I
>display just 76 which is the more conventional way we talk about age.


--
HTH - RuralGuy (RG for short) acXP WinXP Pro
Please post back to this forum so all may benefit.

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200610/1

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculating dates based on the current date DavidW Microsoft Excel Programming 1 29th Mar 2006 01:42 PM
Calculating age, given DOB & current date Paul Hyett Microsoft Access Forms 3 22nd Feb 2006 06:21 PM
Calculating days between current date and a date in future NETWORKDAYS() function Faheem Khan Microsoft Excel Worksheet Functions 2 10th Feb 2005 07:18 PM
Calculating current age from 2 date cells =?Utf-8?B?ZGhlYWx5?= Microsoft Excel Worksheet Functions 1 19th Jan 2005 04:50 PM
Calculating current investment value, current mortgage balance Scott Meyers Microsoft Excel Worksheet Functions 1 10th Jul 2004 08:13 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:45 PM.