حَدَّثَنَا مَسْرُوقُ بْنُ الْمَرْزُبَانِ ، حَدَّثَنَا يَحْيَى بْنُ زَكَرِيَّا ، عَنْ حُمَيْدٍ ، عَنْ أَنَسٍ ، قَالَ : قَالَ رَسُولُ اللهِ صَلَّى اللهُ عَلَيْهِ وَسَلَّمَ : إِذَا جَاءَ أَحَدُكُمْ إِلَى الصَّلَاةِ ، فَلْيَمْشِ عَلَى هِينَتِهِ ، فَلْيُصَلِّ مَا أَدْرَكَ وَلْيَقْضِ مَا سُبِقَهُ .
It is narrated from Sayyiduna Anas (may Allah be pleased with him) that the Messenger of Allah (peace and blessings be upon him) said: "When one of you comes to the prayer, he should walk with complete dignity and calm; then whatever part of the prayer he catches (with the congregation), he should perform, and whatever he has missed, he should complete (afterwards)."
Related hadith on this topic