On Hopf's formulas for solutions of Hamilton--Jacobi equations