We are only interested in the vertical motion of the ball, in order to solve the problem.
The vertical motion of the ball is an uniformly accelerated motion, with constant acceleration
(acceleration of gravity). Therefore, the vertical velocity at time t is given by

where
is the initial vertical velocity of the ball.
The ball reaches its highest point when
: therefore, substituting this information into the equation, we can calculate the time t at which this happens:

