The time for ẓuhr and ʿaṣr prayers is from zawāl [i.e. the time after midday when the sun begins to decline] (known as the ‘legal midday’ (al‑ẓuhr al‑sharʿī))[1] until sunset (ghurūb).
However, in the event that one intentionally (ʿamdan) performs the ʿaṣr prayer before the ẓuhr prayer, his prayer is invalid (bāṭil), except if this happens at the end of the prescribed time and there is scope for performing only one prayer, in which case if someone has not performed the ẓuhr prayer by then, his ẓuhr prayer is deemed to have become qaḍāʾ and he must perform the ʿaṣr prayer.
If before this time someone mistakenly performs the whole of the ʿaṣr prayer before the ẓuhr prayer, his prayer is valid (ṣaḥīḥ), and he must then perform the ẓuhr prayer. And the recommended precaution (al‑iḥtiyāṭ al‑mustaḥabb) is that he should perform the second set of four rakʿahs with the intention (niyyah) to fulfil whatever his legal obligation happens to be (mā fī al‑dhimmah).