Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date 2

Status
Not open for further replies.

Tronsliver

Technical User
Sep 19, 2000
120
0
0
US
I'm trying to find the number of years between two dates: The first date is a persons date of birth compared to todays date.

I'm using the query grid in Access. The formula I've been wrestling with is this:

Years Old = DateDiff("yyyy",[DOB],Date())

I would like the result to give number of years between the two dates: For example 1/1/1900 - 1/1/1925 = 25

Sure would appreciate the help...thx
 
Depending of the real value you want, either:
[Years Old]: Year(Date())-Year([DOB])
Or:
[Years Old]: (Date()-[DOB])\365.25


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Hi,

DateDiff just takes the difference in the YEARS value.

If you changed the first value in your example to the day before, 12/31/1899 (if it were possible) what would you expect? Still 25 years or 26?

Nothing wrong with your code , thought.

Skip,
[sub]
[glasses] [red]Be advised:[/red] Researchers have found another Descartes trueism, "Cogito ergo spud."
"I think; therefore, I YAM!
[tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top