The Messenger of Allah ﷺ said, "Whoever catches one rakah of the dawn prayer before the sun rises has caught the dawn prayer, and whoever catches one rakah of the afternoon prayer before the sun sets has caught the afternoon prayer."
أخبرنا قتيبة عن مالك عن زيد بن أسلم عن عطاء بن يسار وعن بسر بن سعيد وعن الأعرج يحدثون
أن رسول الله ﷺ قال من أدرك ركعة من صلاة الصبح قبل أن تطلع الشمس فقد أدرك الصبح ومن أدرك ركعة من العصر قبل أن تغرب الشمس فقد أدرك العصر
Bukhari transmitted it in the Book of Prayer Times, in the chapter on one who catches a rakat of Fajr, hadith no. 579, and Muslim in the Book of Mosques, in the chapter on one who catches a rakat of a prayer having thereby caught that prayer, hadith no. 163/608, both from the hadith of Malik through this same chain. It is also found in the Muwatta (Yahya's recension), 6/1, and in the Kubra, hadith no. 1502.