If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Date difference to show in years and months
Question 1 (the most important of the 3 related questions)
I have a date of birth field(DOB) and I want to get the age in current years and months to display e.g. as follows: 63 years 11 months I tried to work it out from reading similar questions and answers on Discussions, but haven't been able to. This is as far as I have got. Age: (DateDiff("yyyy",2,Date()-[DOB])) Question 2 When I used (DateDiff("yyyy",1,Date()-[DOB])) I got the date on this year's birthday whether the birthday had arrived or not. When I put in a 2 instead of the 1, I got the correct number of completed years. What does the 1 or the 2 designate? Question 3 Today being 19/09/2009 (South Africa - GMT + 2) and the time I was doing this was about 9.30am, I found that if I had the birthday as being e.g. 19/09/1972 I got the correct answer - 37 completed years. If I had the birthday being 17/09/1972, I got the correct answer (36 completed years). However, if I had the birthday as 18/09/1972 I got the wrong answer of 36 completed years instead of 37. Why? Thank you for any help. |
#2
|
|||
|
|||
Date difference to show in years and months
Go here for three options to calculate age:
http://www.mvps.org/access/datetime/date0001.htm Regards Kevin "Owl" wrote in message ... Question 1 (the most important of the 3 related questions) I have a date of birth field(DOB) and I want to get the age in current years and months to display e.g. as follows: 63 years 11 months I tried to work it out from reading similar questions and answers on Discussions, but haven't been able to. This is as far as I have got. Age: (DateDiff("yyyy",2,Date()-[DOB])) Question 2 When I used (DateDiff("yyyy",1,Date()-[DOB])) I got the date on this year's birthday whether the birthday had arrived or not. When I put in a 2 instead of the 1, I got the correct number of completed years. What does the 1 or the 2 designate? Question 3 Today being 19/09/2009 (South Africa - GMT + 2) and the time I was doing this was about 9.30am, I found that if I had the birthday as being e.g. 19/09/1972 I got the correct answer - 37 completed years. If I had the birthday being 17/09/1972, I got the correct answer (36 completed years). However, if I had the birthday as 18/09/1972 I got the wrong answer of 36 completed years instead of 37. Why? Thank you for any help. |
#3
|
|||
|
|||
Date difference to show in years and months
Check "A More Complete DateDiff Function" at
http://www.accessmvp.com/djsteele/Diff2Dates.html -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no private e-mails, please) "Owl" wrote in message ... Question 1 (the most important of the 3 related questions) I have a date of birth field(DOB) and I want to get the age in current years and months to display e.g. as follows: 63 years 11 months I tried to work it out from reading similar questions and answers on Discussions, but haven't been able to. This is as far as I have got. Age: (DateDiff("yyyy",2,Date()-[DOB])) Question 2 When I used (DateDiff("yyyy",1,Date()-[DOB])) I got the date on this year's birthday whether the birthday had arrived or not. When I put in a 2 instead of the 1, I got the correct number of completed years. What does the 1 or the 2 designate? Question 3 Today being 19/09/2009 (South Africa - GMT + 2) and the time I was doing this was about 9.30am, I found that if I had the birthday as being e.g. 19/09/1972 I got the correct answer - 37 completed years. If I had the birthday being 17/09/1972, I got the correct answer (36 completed years). However, if I had the birthday as 18/09/1972 I got the wrong answer of 36 completed years instead of 37. Why? Thank you for any help. |
Thread Tools | |
Display Modes | |
|
|