scalar field in homogeneous, time-dependent electric fields or magnetic fields prescribed by vector potentials. The Hamiltonian from the field action in time-dependent electric fields is decomposed by the Fourier modes and is expressed as a sum of decoupled, time-dependent oscillators. In time-dependent magnetic fields, the Hamiltonian is decomposed both by the Fourier modes along the longitudinal direction and by the Landau states in the transverse plane that diagonalize the transverse part of the Hamiltonian. In Sec. \[sec3\], we study the time-dependent Schrödinger equation for the quadratic Hamiltonian in the extended phase space of positions and momenta and search for the quantum invariants for the field. In Sec. \[sec4\], we find the time-dependent annihilation and the creation operators, construct the Fock space for the charged scalar field in time-dependent electric fields, and discuss the pair production and the vacuum persistence amplitude. In Sec. \[sec5\], we extend the quantum invariant method to find the time-dependent annihilation and the creation operators for the charged field in time-dependent magnetic fields. We advance a perturbation method to find the improved quantum states beyond the Landau states when the magnetic fields change adiabatically. We show that the Hamiltonian has the same algebraic structure even when an 