  We develop an elementary method to give a Lipschitz estimate for the
minimizers in the problem of Herglotz' variational principle proposed in
\cite{CCWY2018} in the time-dependent 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 equation
  \begin{align*}
  D_tu(t,x)+H(t,x,D_xu(t,x),u(t,x))=0
  \end{align*}
  and study the related Lax-Oleinik evolution.
