The Prophet ﷺ said, "Whoever catches one rakah of the dawn prayer before the sun rises has caught the prayer, and whoever catches one or two rakahs of the afternoon prayer before the sun sets has caught the prayer."
حدثنا محمد بن جعفر حدثنا محمد بن عمرو عن أبي سلمة
عن النبي ﷺ أنه قال من أدرك ركعة من صلاة الصبح قبل أن تطلع الشمس فقد أدرك ومن أدرك ركعة أو ركعتين من صلاة العصر قبل أن تغرب الشمس فقد أدرك
Suyuti reported it similarly in Jami Saghir, with the wording, "Whoever catches a rakat of the prayer has caught the prayer." Bukhari, Muslim, Abu Dawud, Tirmidhi, Nasai, and Ibn Majah reported it from Abu Hurairah, and he indicated that it was sahih.