Connecting Tech Pros Worldwide Help | Site Map

Find age of employee

  #1  
Old July 11th, 2007, 06:15 AM
Scott
Guest
 
Posts: n/a
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

  #2  
Old July 11th, 2007, 01:05 PM
teddysnips@hotmail.com
Guest
 
Posts: n/a

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

  #3  
Old July 11th, 2007, 04:05 PM
Larry Linson
Guest
 
Posts: n/a

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to find the count of employee in the following issue suresh508 answers 1 August 9th, 2007 10:44 AM
How to find difference in years between two dates? thebjorn answers 23 July 29th, 2006 08:55 AM
Using "SELECT * " is a bad practice even when using a VIEW instead of a table? serge answers 10 October 20th, 2005 11:05 PM
Using "SELECT * " is a bad practice even when using a VIEW instead of a table? serge answers 0 October 14th, 2005 03:45 AM