By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,659 Members | 1,714 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,659 IT Pros & Developers. It's quick & easy.

Script for current age seems to be rounding

P: 1
I am working in a financial program called Sage Fund Accounting, Human Resources Management. We offer life insurance as a benefit to staff and the premiums are based on age and benefit amount. I've got the age bands and premium based on age set up and that's working properly. My problem is that the formula I'm using to calculate age seems to be rounding up in certain instances. For example, I will turn 35 this year in September and will then be moved to the next age band. I am currently in the 29-34 band and will be in the 35-39 band. My formula is calculating my age now as 35 instead of 34 so I am being billed at a higher premium well before I should be.

This is the formula I am using for age: DateDiff(YY, dtmBirthday, GetDate())

I cannot have any quotes "" in the formula, I tried YYYY instead of YY, I tried Now instead of GetDate()) and I am getting frustrated because it seems like this software has "special" conditions for the script that it will accept.

I sure would appreciate help that anyone can offer.
Feb 13 '13 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 10K+
P: 12,370
When you use years, it just subtracts one year from another.

Use months and then divide by 12. This can still be inaccurate if it's run during the month of their birthday.

If you need it more accurate, use days and divide by 365.25.

And if you need absolute accuracy, use days, subtract the number of leap years, and then divide by 365.
Feb 13 '13 #2

Post your reply

Sign in to post your reply or Sign up for a free account.