Looking for some help in this, I've been going crazy on it. The way we are doing it with the regular formula tool is this:
DateTimeDiff([HIRE_PROCESS_TS],[BIRTH_DT],'year')
This gives the age and seems to be correct. So when I moved to in-db, I tried to just use a DateDiff and use it the same way the DateTimeDiff works, but it wasn't working so I have ended up with the following formula in my in-db formula:
floor(datediff(day, [BIRTH_DT], [HIRE_PROCESS_TS])/365.23076923074)
This one is not correct and has haunted me for a while. I can't figure out what I am doing wrong. Any help on this would be greatly appreciated. I'm using a SQL database.
HIRE_PROCESS_TS | BIRTH_DT | Age_FormulaTool | Age_In-DB_FormulaTool |
2005-07-01 10:17:22 | 1958-07-02 | 47 | 46 |
2010-01-13 09:14:55 | 1967-01-14 | 43 | 42 |
2010-02-19 09:42:31 | 1968-02-20 | 42 | 41 |
Solved! Go to Solution.
(YEAR(@CurrentDate) * 10000 + MONTH(@CurrentDate) * 100 + DAY(@CurrentDate) - YEAR(@DateOfBirth) * 10000 - MONTH(@DateOfBirth) * 100 - DAY(@DateOfBirth) ) / 10000
I found this answer at: dba.stackexchange.com
Thank you very much. I looked forever and couldn't find a formula that was working. Now I am matching 100%.
Kevin,
You're quite welcome. I'd like to take credit for knowing the answer, so I will. Just kidding. Google and I are close friends. Glad to hear that you're 100%.
Cheers,
Mark