procedure LastInMonth(Date d,var Date res) BEGIN Integer i,j; i = GetYear(d); j = GetMonth(d); i = DaysInMonth(i,j); j = GetDay(d); i = i-j; res = AddDay(d,i); RETURN; END;