I wanted to ask when do the time of dhuhar and Asr prayer end do they both end together? And same question for Magrib and Isha prayer

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 room 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).

For a person under normal circumstances, the time for the maghrib prayer is until midnight, but for a helpless person – who due to forgetfulness, oversleeping, menstruation (ḥayḍ), or suchlike did not perform prayers before midnight – the time for maghrib and ʿishāʾ prayers is extended until dawn. However, in both cases, the proper order between the two prayers must be observed, meaning that if the ʿishāʾ prayer is knowingly performed before the maghrib prayer, it is invalid unless the time remaining is sufficient only for performing the ʿishāʾ prayer, in which case it is necessary that one performs the ʿishāʾ prayer before the maghrib prayer.