473,322 Members | 1,431 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

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

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
5 5292
MMcCarthy
14,534 Expert Mod 8TB
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
1,418 Expert 1GB
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
1,418 Expert 1GB
With Format you can also calculate the hours and minutes of the difference! ;)
Sep 8 '06 #4
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
rzgar
3
for "year and month and day" ???
please
Jan 11 '17 #6

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

Similar topics

18
by: pb648174 | last post by:
Greeting, below is the complete SQL taken from aspfaq.com (retrieved from this newsgroup I believe) The query takes about two minutes to run. Does anybody have a better set based way (sub-second...
3
by: kaming | last post by:
Dear all, Do any one have idea how to obtain the exactly number of seconds in a month with given month and year using DB2 given functions? The formula is as simple as "No_of_days_for_a_month" *...
2
by: Issac Gomez | last post by:
IN VB.Net, you can use the DateDiff method to calculate the difference between 2 days. How do you do this in C#? I want to find the number of days between 2 dates. I there a 0 days, then I want to...
2
by: smcgrath via AccessMonster.com | last post by:
I have a table listing accounts with a closed date - our Trial balance drops the account after 7 days but our database keeps the record forever - How do I calculate the end of month less 7 days so...
4
by: jamesyreid | last post by:
Hi, I'm really sorry to post this as I know it must have been asked countless times before, but I can't find an answer anywhere. Does anyone have a snippet of JavaScript code I could borrow...
4
by: YardDancer | last post by:
Dear All, I am upgrading my skills from VB 6.0 to VB.Net. They say you can do all date and time calculations using the properties and methods of DateTime structure withour recourse to the...
2
by: mshroom12 | last post by:
I am having trouble with the following project on hand. I use Eclipse to do my work in Java. This is what I'm supposed to complete. Date Validation In this exercise you will write a program...
7
by: plumba | last post by:
Hiya all. I have a form which the user selects a date from a javascript style calendar, it puts the date into a field in the format dd/mm/yyyy. I want the form to compare this user selected...
3
by: =?Utf-8?B?cm9kY2hhcg==?= | last post by:
hey all, is there a way if you are given a Year and a Week an easy way to go back say 26 weeks ago from given year/week. for example, given: 2008/16 26 weeks prior is: 2007/43 thanks,
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.