We develop an elementary method to give a Lipschitz estimate for the minimizers in the problem of Herglotz' variational principle proposed in [17] in the timedependent case. We deduce Erdmann's condition and the Euler-Lagrange equation separately under different sets of assumptions, by using a generalized du Bois-Reymond lemma. As an application, we obtain a representation formula for the viscosity solution of the Cauchy problem for the Hamilton-Jacobi equationand study the related Lax-Oleinik evolution. with u ξ (a) = u ∈ R, for b > a. The so-called Herglotz' variational principle is to seek an extremal ξ of the functional u[ξ] := u ξ (b) − u = b a L(s, ξ(s), ξ(s), u ξ (s)) ds,