how long? there are many variables involved, but it will take some time(maybe a month or 2) to regain control,that all depends on how much of a problem youalready have and how well your macros are doin, but
hang in there, it will come
PATIENCE, nothing here happens fast
if you pruneand harvest some of the algae you have in your tank, this may help to speed up the cycle and make sure you have a good alk and calcium in your wate, this will help your macros to flourish, which will more than likely help
HTH