It wasnarrated from Abu Dharr that the Prophet (ﷺ) said:
"Offerprayeron time, and if you reached the Imam leading them in prayers(ontime), then perform it with them, and you will be safe with yourprayer, otherwise it will be voluntary for you."
English reference: Vol. 1, Book 5, Hadith 1256
Arabic reference: Book 5, Hadith 1314
Read hadith from the major collections in the app, with prayer times and a Qibla compass. Free.