Predicting the critical time of financial bubbles