problem. MSC (2010) 49K20, 49K15, 49K21, 93C30, 90C46An optimal control problem with a time-parameter is considered. The functional to be optimized includes the maximum over time-horizon reached by a function of the state variable, and so an L ∞ -term. In addition to the classical control function, the time at which this maximum is reached is considered as a free parameter. The problem couples the behavior of the state and the control, with this time-parameter. A change of variable is introduced to derive first and second-order optimality conditions. This allows the implementation of a Newton method. Numerical simulations are developed, for selected ordinary differential equations and a partial differential equation, which illustrate the influence of the additional parameter and the original motivation.Notation. When there is no ambiguity, the time variable is sometimes omitted, or written only once (e. g. H (y, u, p) H (y(s), u(s), p(s)). First and second-order partial derivatives are denoted with the use of indexes. The first and second-order derivatives with respect to all variables (except the adjoint state p and the Lagrange multiplier λ, for the Hamiltonian and the Lagrangians) are denoted by D and D 2 , respectively. The partial derivative of a function ϕ with respect to a variable y in a direction z is denoted as ϕ y (y).z. When a function h is left-and right-continuous at a given time t, the left-and right-limits are denoted by h(t − ) and h(t + ), respectively, and the jump is denoted by [h] t .