I am trying to take an In Process date and count how many Years, Months, and Days it has been In Process from CurrentDate. Awhile ago someone gave me the formula below but it didn't work. It returns "0 Yrs 0 Mos 17 Days". What am I missing?
//The following assumes you have inserted a group on {table.acct} and that you have
//one date field you are comparing across years.
//Go to the field explorer->formula->new and enter:
datetimevar min := minimum({@Character field to date field in process date});
datetimevar max := maximum({@Character field to date field in process date});
numbervar yrs := datediff("yyyy",min,max);
numbervar mos;
if month(max) >= month(min) then
mos := datediff("m",min,max)-(yrs*12) else
if month(max) < month(min) then (
yrs := yrs-1;
mos := datediff("m",min,max)-(yrs*12)
);
numbervar days :=
if day(max)>= day(min) then
days := day(max) - day(min) else
if day(max) < day(min) then (
mos := mos-1;
days := day(max)+(day(max-day(max))-day(min))
);
totext(yrs,0,"")+" Yrs "+totext(mos,0,"")+" Mos "+totext(days,0,"")+ " Days"
//The following assumes you have inserted a group on {table.acct} and that you have
//one date field you are comparing across years.
//Go to the field explorer->formula->new and enter:
datetimevar min := minimum({@Character field to date field in process date});
datetimevar max := maximum({@Character field to date field in process date});
numbervar yrs := datediff("yyyy",min,max);
numbervar mos;
if month(max) >= month(min) then
mos := datediff("m",min,max)-(yrs*12) else
if month(max) < month(min) then (
yrs := yrs-1;
mos := datediff("m",min,max)-(yrs*12)
);
numbervar days :=
if day(max)>= day(min) then
days := day(max) - day(min) else
if day(max) < day(min) then (
mos := mos-1;
days := day(max)+(day(max-day(max))-day(min))
);
totext(yrs,0,"")+" Yrs "+totext(mos,0,"")+" Mos "+totext(days,0,"")+ " Days"