Can the Lagrangian be written as a function of ONLY time?

  1. Using the EL equations (or inserting their solutions) into the action functional typically destroys the stationary action principle. For examples, see this Phys.SE post.

  2. Concerning OP's title question: If a Lagrangian $L(t)$ only depends on time $t$, then it can be written as a total time derivative $L=dF/dt$, and that means it is equivalent to the trivial Lagrangian $L=0$, i.e. the EL equations are trivial.

When doing this, it removes one of the great powers Lagrangian mechanics: the Euler-Lagrange equations, which are

$$\frac{d}{dt} \frac{\partial L}{\partial \dot{q}} = \frac{\partial l}{\partial q}$$

Notice in the equations, we have partial derivatives. So if we made $L=L(t)$, then the Euler Lagrange equations would give you $0=0$ (a beautiful fact, but nonetheless not very helpful). Plus, the Euler-Lagrange equations are meant to give you equations of motion, so one probably wouldn't be able to substitute equations for $q(t)$ or $\dot{q}(t)$ anyways.

Edit: There is actually a more fundamental problem when you do this (and thank you so much to Qmechanic and ZeroTheHero for bringing this to my attention). If you simply plug back the motion into your Lagrangian and then try to apply the Euler-Lagrange equations again, you will more than likely get the wrong equation of motion. For example take the simple spring:

$$L = \frac{m\dot{x}^2}{2} - \frac{kx^2}{2} \implies m\ddot{x}=-kx \implies x=\sin(\sqrt{k/m}\cdot t)$$ (just one possible solution)

where we used the EL eqs. However, if we plug this back into our Lagrangian, we will not get the right equations of motion:

$$L = \frac{m\dot{x}^2}{2} - \frac{k\sin^2(\sqrt{k/m}\cdot t)}{2} \implies m\ddot{x} = 0$$(!!!)