It happens to work for alternating currents, too, if you take the RMS of the voltage.EDIT: The P=I*V equation is only true instantaneously. For time-varying potentials or currents, the relationship must be treated as a differential one, and integrated over time.