We introduce an exact framework to compute the positive frequency moments M(α)(q)=⟨ωα⟩ of different dynamic properties from imaginary-time quantum Monte Carlo data. As a practical example, we obtain the first five moments of the dynamic structure factor S(q,ω) of the uniform electron gas at the electronic Fermi temperature based on \emph{ab initio} path integral Monte Carlo simulations. We find excellent agreement with known sum rules for α=1,3, and, to our knowledge, present the first results for α=2,4,5. Our idea can be straightforwardly generalized to other dynamic properties such as the single-particle spectral function A(q,ω), and will be useful for a number of applications, including the study of ultracold atoms, exotic warm dense matter, and condensed matter systems.