A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Date difference to show in years and months



 
 
Thread Tools Display Modes
  #1  
Old September 19th, 2009, 09:32 AM posted to microsoft.public.access.queries
owl
external usenet poster
 
Posts: 128
Default 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  
Old September 19th, 2009, 01:39 PM posted to microsoft.public.access.queries
Kc-Mass
external usenet poster
 
Posts: 362
Default 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  
Old September 19th, 2009, 03:17 PM posted to microsoft.public.access.queries
Douglas J. Steele[_3_]
external usenet poster
 
Posts: 3,143
Default 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

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:03 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.