To get the time needed to reach maximum height, you use this simple logic :
if your vertical velocity is higher than zero at a certain point, then you are still moving up, so that point is not max height.
if your vertical velocity is lower than zero at a certain point, then you have already fallen from the max height.
so you are only at the maximum height when your vertical velocity is zero.
Vy=Uy+at
set Vy=0
so at=-Uy
t=-Uy/a