By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,455 Members | 2,157 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,455 IT Pros & Developers. It's quick & easy.

calculation of up to date age in terms of year/moth/days

P: 17
Dear freinds,

I need date difference in terms of years/months/days i.e. i want to create a calculated field to show the age of person in year months and days. The DateDiff() expression of MS Access calculates the age in years only and do not show the month and days.

Will you please help me

thanks a lot in advance
Sep 8 '06 #1
Share this Question
Share on Google+
5 Replies


MMcCarthy
Expert Mod 10K+
P: 14,534
DateDiff will calculate whatever you want days, months or years. See following examples

DateRange = DateDiff("yyyy", #10/15/1998#, #11/22/2003#) 'would return 5
DateRange = DateDiff("m", #10/15/2003#, #11/22/2003#) 'would return 1
DateRange = DateDiff("d", #10/15/2003#, #11/22/2003#) 'would return 38

Dear freinds,

I need date difference in terms of years/months/days i.e. i want to create a calculated field to show the age of person in year months and days. The DateDiff() expression of MS Access calculates the age in years only and do not show the month and days.

Will you please help me

thanks a lot in advance
Sep 8 '06 #2

PEB
Expert 100+
P: 1,418
PEB
Try the following:

Mid(Format(Now()-Cvdate("08/04/1980")-1,"yyyy/mm/dd"),3,len(Format(Now()-Cvdate("23/03/1980")-1,"yyyy/mm/dd")))
Sep 8 '06 #3

PEB
Expert 100+
P: 1,418
PEB
With Format you can also calculate the hours and minutes of the difference! ;)
Sep 8 '06 #4

P: 20
I use the following and have had no problems.

DateDiff("yyyy",tbl.DOB,tbl.Date)+Int(Format(tbl.D ate,"mmdd")<Format(tbl.DOB,"mmdd")) AS Age

Ivan
Sep 8 '06 #5

P: 3
for "year and month and day" ???
please
Jan 11 '17 #6

Post your reply

Sign in to post your reply or Sign up for a free account.