Connecting Tech Pros Worldwide Help | Site Map

Find age of employee

Scott
Guest
 
Posts: n/a
#1: Jul 11 '07
I have two fields in a query that hold dates. One is DOB, the other is
HireDate. I want to add a field to a query that will take the
employees DOB and based on their hire date, wil display their age in
years and months at the time they were hired. I then need to add a
query field to take the HireDate and TermDate (termination date) to
show their length of tenure with the company.

Thanks-

Scott

teddysnips@hotmail.com
Guest
 
Posts: n/a
#2: Jul 11 '07

re: Find age of employee


On 11 Jul, 06:06, Scott <s...@henryschein.comwrote:
Quote:
I have two fields in a query that hold dates. One is DOB, the other is
HireDate. I want to add a field to a query that will take the
employees DOB and based on their hire date, wil display their age in
years and months at the time they were hired. I then need to add a
query field to take the HireDate and TermDate (termination date) to
show their length of tenure with the company.
Read up on DateDiff.

To get the age of the employee in years at the date of hire :

SELECT DateDiff("yyyy", DOB, Hired) as StartAge
FROM Table1;

The rest is left as an exercise for the reader.

Edward

Larry Linson
Guest
 
Posts: n/a
#3: Jul 11 '07

re: Find age of employee


<teddysnips@hotmail.comwrote
Quote:
Read up on DateDiff.
>
To get the age of the employee in years at the date of hire :
>
SELECT DateDiff("yyyy", DOB, Hired) as StartAge
FROM Table1;
Read up on DateDiff.

From the immediate window:

? DateDiff("y",#12/31/2000#,#01/01/2001#)
1

By normal reckoning, a baby born on the 31st of December is not one year old
the next day.

? DateDiff("yyyy",#12/31/2000#,#01/01/2007#)
7

According to most cultures, a person born the 31st of December 2000 will not
be 7 years old until the 31st of December 2007.

Yes, there are cultures in which the child is considered age 1 at the moment
of birth. Is your culture one of those? But, in any case, the simplistic
calculation you show is not accurate for that view either.

There is a Knowledge Base article on calculating age at
http://support.microsoft.com/kb/100136/en-us which takes the date within the
year into account.


Closed Thread