We consider the time-dependent dynamical system q¨a=−Γbcaq˙bq˙c−ω(t)Qa(q) where ω(t) is a non-zero arbitrary function and the connection coefficients Γbca are computed from the kinetic metric (kinetic energy) of the system. In order to determine the quadratic first integrals (QFIs) I we assume that I=Kabq˙aq˙b+Kaq˙a+K where the unknown coefficients Kab,Ka,K are tensors depending on t,qa and impose the condition dIdt=0. This condition leads to a system of partial differential equations (PDEs) involving the quantities Kab,Ka,K,ω(t) and Qa(q). From these PDEs, it follows that Kab is a Killing tensor (KT) of the kinetic metric. We use the KT Kab in two ways: a. We assume a general polynomial form in t both for Kab and Ka; b. We express Kab in a basis of the KTs of order 2 of the kinetic metric assuming the coefficients to be functions of t. In both cases, this leads to a new system of PDEs whose solution requires that we specify either ω(t) or Qa(q). We consider first that ω(t) is a general polynomial in t and find that in this case the dynamical system admits two independent QFIs which we collect in a Theorem. Next, we specify the quantities Qa(q) to be the generalized time-dependent Kepler potential V=−ω(t)rν and determine the functions ω(t) for which QFIs are admitted. We extend the discussion to the non-linear differential equation x¨=−ω(t)xμ+ϕ(t)x˙(μ≠−1) and compute the relation between the coefficients ω(t),ϕ(t) so that QFIs are admitted. We apply the results to determine the QFIs of the generalized Lane–Emden equation.