geno
02-21-2002, 02:56 PM
Hi, I have an employee table and need to convert the start date into years and months. This is the datediff function I have used:
Date in Years: DateDiff("yyyy",[date],Now()) & " years and " & DateDiff("m",[date],Now())-(DateDiff("yyyy",[date],Now())+Int(Format(Now(),"mmdd")<Format([date],"mmdd")))*12 & " months"
This works great for the dates that are over a year from the current date, but anything less returns the wrong date. eg: 11/14/01 returns 1 year and 3 months when it should be 3 months. Thanks for any help.
Date in Years: DateDiff("yyyy",[date],Now()) & " years and " & DateDiff("m",[date],Now())-(DateDiff("yyyy",[date],Now())+Int(Format(Now(),"mmdd")<Format([date],"mmdd")))*12 & " months"
This works great for the dates that are over a year from the current date, but anything less returns the wrong date. eg: 11/14/01 returns 1 year and 3 months when it should be 3 months. Thanks for any help.