The World Federation One Stop Fiqh

Ruling 732

If a person is unaware of the fact that he must be certain that the time for prayers has set in and he starts performing the prayer, in the event that after the prayer he realises that he had performed the entire prayer within its time, his prayer is valid. However, if he realises that he performed the prayer before the time had set in, or he does not know whether he had performed the prayer within its time or before it, his prayer is invalid. In fact, if he realises after the prayer that the time had set in during the prayer, he must perform that prayer again.