Question Locked

DATEDIFF FUNCTION

0 helpful
4 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hi,

Im a developer. I have a question on the DATEDIFF function, hope you can help me out. Im using DATEDIFF function, I know that it will result in integer value. But, I need the result in decimals.

For example :

STARTDATE ENDATE RESULT
8/27/2003 9/2/1976 26.11
9/1/2003 1/6/2000 3.8

CAN YOU PLEASE HELP ME ?

THANKS IN ADVANCE

4 replies

by locolobo

you set the interval to days and divide by 365.25 store it in a decimal (single) variable?

Is this VB?

by rwidegren

If you want the result to be the number of years to the left of the decimal and the number of months to the right (as a whole number) then you could do the DateDiff in months and divide by 12. The integer part would be the years and the Mod would be the extra months.

This discussion is closed to new replies.