How do I calculate age from social security number?

G

Guest

How do I calculate age using a 13 digit social security number where the the
first six digits is DOB (yy/MM/dd). I tried Select Left 6 digits and calling
that DOB and then do DateDiff but this DOB field is not date format. Can
anyone help. I am using Access 2003.
 
R

Rick B

Ummmm Social Security numbers do not include a birthdate. (Unless they have
"social security numbers" outside the US and I am not aware of it. My
social Security number is 452-XX-XXXX. I was born in December of 1968.

If that is the case, I'm sure there is a way to turn a six-digit number into
a date. I have seen it posted out here before. It seems like it put the
digits into the "date serial" somehow. Once you got that, you'd use the
following to calcualte age.


The proper formula to calculate Age is...

DateDiff("yyyy",[Birthdate],Date())+(Format([Birthdate],"mmdd")>Format(Date(
),"mmdd"))
 
R

Rick B

Just saw that you said 13-digit. Obviously not a US social security (they
are 9 digits). Disregard the first part of my post.
 
B

Brendan Reynolds

You could use the DateSerial function ...

?
dateserial(cint(left$("050101",2)),cint(mid$("050101",3,2)),cint(mid$("050101",5,2)))
01/01/2005

Note, though, that the format is not Y2K compatible. There is no way to tell
whether someone with a number begining '050101' is three months old (1 Jan
2005) or 100 years old (1 Jan 1905).
 
P

Pavel Romashkin

Perhaps you could enclose the string into # signs to signify that it is
a date?

Cheers,
Pavel
 
T

Tim Ferguson

Perhaps you could enclose the string into # signs to signify that it
is a date?
No: I she really means the first six digits then it's not going to be a
legitimate date format in any language ("031225") with or without the
hash marks.

Chopping out the digits and passing them to DateSerial is the only safe
method.

All the best


Tim F
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top