I have an important doubt about the nature of canonical transformations in hamiltonian mechanics.
Suppose I have a one-degree-of-freedom lagrangian system, whose hamiltonian depends explicitly on time:
$$\frac{\partial{\mathcal{H}(p, q, t)}}{\partial{t}} \neq 0$$
so in principle energy is not a conserved quantity. Then I find a canonical transformation, $Q(q, t), P(p, t)$ such that the new hamiltonian, $\mathcal{H}'$ has no explicit time dependency:
$$\mathcal{H}' = \mathcal{H}'(Q, P)$$
Can I say then that indeed energy is a conserved quantity?
If the answer is yes, then it's a bit counter-intuitive for me, specially if it is more or less easy to find such transformations. And if the answer is no, then that makes me think that canonical transformations don't conserve the nature of the system.