We present a constant-Q time-domain wave equation. It is derived from Kjartansson's constant-Q constitutive stress-strain relation in combination with the mass and momentum conservation equations. Our wave equation, expressed by a second order temporal derivative and two fractional Laplacian operators, models attenuation and dispersion effects. The temporal derivative is solved by the staggered-grid finite-difference approach. The fractional Laplacian is easily calculated in the spatial frequency domain using say a Fourier pseudo-spectral implementation. The advantage of using our fractional Laplacian formulation over the traditional fractional time derivative approach is the avoidance of storing the time history of variables and thus more economic in computational costs. In numerical simulations, we incorporate PML (perfectly matched layer) absorbing boundaries. Furthermore, we verify the accuracy of numerical results through comparisons with theoretical constant-Q attenuation and dispersion solutions, McDonal's measurements in the Pierre shale, and results from 2-D viscoacoustic analytical modeling for the homogeneous Pierre shale. We then generalize our rigorous formulation for viscoacoustic waves in homogeneous media to an approximate equation for heterogeneous media. We demonstrate the applicability and efficiency of our constant-Q time-domain approach wave equation in a heterogeneous medium with highly atttenuative formation.