In recent years, matter-wave interferometry has attracted growing attention due to its unique suitability for high-precision measurements and the study of fundamental aspects of quantum theory. Diffraction and interference of matter waves can be observed not only at a spatial aperture (such as a screen edge, slit, or grating), but also at a time-domain aperture (such as an absorbing barrier, or “shutter,” that is being periodically switched on and off). The wave phenomenon of the latter type is commonly referred to as “diffraction in time.” Here, we introduce a versatile, exactly solvable model of diffraction in time. It describes time evolution of an arbitrary initial quantum state in the presence of a time-dependent absorbing barrier, governed by an arbitrary aperture function. Our results enable a quantitative description of diffraction and interference patterns in a large variety of setups, and may be used to devise new diffraction and interference experiments with atoms and molecules.