Sahih al-Bukhari, Book 72, Hadith 26 (In-Book)

Narrated Jundub bin Sufyan Al-Bajali: Once during the lifetime of Allah's Messenger we offered some animals as sacrifices. Some people slaughtered their sacrifices before the (Id) prayer, so when the Prophet finished his prayer, he saw that they had slaughtered their sacrifices before the prayer. He said, "Whoever has slaughtered (his sacrifice) before the prayer, should slaughter (another sacrifice) in lieu of it; and whoever has not yet slaughtered it till we have prayed; should slaughter (it) by mentioning Allah's Name."

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

sunnah.com