حَدَّثَنَا مُحَمَّدُ بْنُ بَشَّارٍ، حَدَّثَنَا مُحَمَّدُ بْنُ جَعْفَرٍ، حَدَّثَنَا شُعْبَةُ، عَنْ أَبِي عِمْرَانَ الْجَوْنِيِّ، عَنْ عَبْدِ اللَّهِ بْنِ الصَّامِتِ، عَنْ أَبِي ذَرٍّ، عَنِ النَّبِيِّ ـ صلى الله عليه وسلم ـ قَالَ ‏"‏ صَلِّ الصَّلاَةَ لِوَقْتِهَا فَإِنْ أَدْرَكْتَ الإِمَامَ يُصَلِّي بِهِمْ فَصَلِّ مَعَهُمْ وَقَدْ أَحْرَزْتَ صَلاَتَكَ وَإِلاَّ فَهِيَ نَافِلَةٌ لَكَ ‏"‏ ‏.‏

It wasnarrated from Abu Dharr that the Prophet (PBUH) 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.” Translation Not Available

Book Ref: Sunan Ibn Majah Book 5 Hadith 1256
Web Ref:  Sunan Ibn Majah Vol 1 Book 5 Hadith 1256