The velocity vector of the projectile body initially is
v0=ucos30i+usin30j,
after a time t the velocity vector is
v=ucos30i+(usin30-gt)j
The two vectors are perpendicular so their dot product is zero. we get that ucos30xucos30+usin30xusin30=ugtsin30
=>u2=ugtsin30
=>t=u/gsin30
=> t=2u/g
=> t = 2*20/10 (g = 10)
=> t = 4 sec