Find for $A,B > 0$ a function $D_{A,B}:\mathbb{R}\to \mathbb{C}$ so that \begin{align} \int_{-A}^{B}\hat{f}(t)e^{2\pi itx} dt=\int_{\mathbb{R}} f(x-y) D_{A,B}(y) dy \end{align}
My attempt: \begin{align} \int_{-A}^{B}\hat{f}(t)e^{2\pi itx} dt&=\int_{-A}^{B}\int_{\mathbb{R}}f(x) e^{-2\pi itx}e^{2\pi itx} dt\\ &=\int_{-A}^{B}\int_{\mathbb{R}}f(x) dxdt\\ \end{align} because of Fubini \begin{align} &=\int_{\mathbb{R}}\int_{-A}^{B}f(x) dtdx\\ &=\int_{\mathbb{R}}f(x)(B+A)dx\\ &=\int_{\mathbb{R}}f(x-y)(-B-A)dy \end{align}
My function $D_{A,B}:\mathbb{R}\to \mathbb{C}$ would be $(-A-B)$. I think I did something wrong because my funtion is independent of $y$.
Your expression for the Fourier transform of $f$ should not re-use the variable $x$, so the cancellation doesn't make sense. Instead, notice that if we let $\chi_{[-A,B]}$ denote the characteristic function on $[-A,B]$, then $$\int\limits_{-A}^B\hat{f}(t)e^{2\pi itx}\, dt=\int\limits_{\mathbb{R}}\chi_{[-A,B]}(t)\hat{f}(t)e^{2\pi itx}\, dt=\mathcal{F}^{-1}(\chi_{[-A,B]}\mathcal{F} f)(x)=f*\mathcal{F}^{-1}(\chi_{[-A,B]})(x)$$ by the convolution theorem, and $$\int\limits_{\mathbb{R}} f(x-y)D_{A,B}(y)\, dy= f*D_{A,B}(x).$$ So, $$D_{A,B}(x)=\mathcal{F}^{-1}(\chi_{[-A,B]})(x)=\int\limits_{-A}^B e^{2\pi i tx}\, dt=\frac{e^{2\pi i Bx}-e^{-2\pi i Ax}}{2\pi i x}$$