I don't think there is a difference function for date, you will probably have to do this manually. Though I don't have the specifics for you, the general approach would be to:
convert each to just date format
extract the year, month and day for each date and store in different variable
subtract system year from year, system month from month, etc.
if the month or day of db is greater than system month or day, "carry" from the year or the month.
store the differences in variables as well
apply logic to figure out date.
or easier might be to convert the difference to days. and then convert it back into date.
p.s. don't forget to post a FAQ when you are finished

[sig][/sig]