The Lagrangian and the Hamiltonian both can also be explicitly time dependent. The Lagrangian is a function of q, \dot{q}, and (sometimes) of time. The Hamiltonian is the Legendre transformation of the Lagrangian wrt. \dot{q} vs. the canonical momentum
p=\frac{\partial L}{\partial \dot{q}},
i.e.,
H=p \cdot \dot{q}-L.
The total differential is
\mathrm{d} H=\mathrm{d}p \cdot \dot{q} + p \cdot \mathrm{d} \dot{q}-\mathrm{d} q \cdot \frac{\partial L}{\partial q}-\mathrm{d} \dot{q} \cdot \frac{\partial L}{\partial \dot{q}}-\mathrm{d} t \frac{\partial L}{\partial t}=p \cdot \mathrm{d} \dot{q}-\mathrm{d} q \cdot \frac{\partial L}{\partial q}-\mathrm{d} t \frac{\partial L}{\partial t}.
From this you read off that the "natural variables" for H are indeed q, p, and t, and that the following relations hold
\left (\frac{\partial H}{\partial p} \right)_{q,t}=\dot{q}, \quad \left (\frac{\partial H}{\partial q} \right)_{p,t}=-\left (\frac{\partial L}{\partial q} \right )_{\dot{q},t}, \quad \left (\frac{\partial H}{\partial t} \right )_{q,p}=-\left (\frac{\partial L}{\partial t} \right)_{q,\dot{q}}.
It is important to keep in mind that in the latter relations different variables are kept fixed when the partial derivative wrt. to the pertinent variable is taken on both sides of this equation! That's why I put the variables to be hold fixed in the different cases as subscipts of the parantheses around the partial derivative explicitly!