We present Car-Parrinello and Car-Parrinello/molecular mechanics simulations of the structural, vibrational, and electronic properties of formaldehyde in water. The calculated properties of the molecule reproduce experimental values and previous calculations. The n → π* excitation energy, calculated with TDDFT and CASPT2, agrees with experimental data. In particular, it shows a blue shift on going from the gas phase to aqueous solution. Temperature and wave function polarization contributions have been disentangled.