Hadithcore
Sahih al-Bukhari, 5546
sahih

Narrated Anas bin Malik:

The Prophet (ﷺ) said, "Whoever slaughtered the sacrifice before the prayer, he just slaughtered it for himself, and whoever slaughtered it after the prayer, he slaughtered it at the right time and followed the tradition of the Muslims."

حَدَّثَنَا مُسَدَّدٌ، حَدَّثَنَا إِسْمَاعِيلُ، عَنْ أَيُّوبَ، عَنْ مُحَمَّدٍ، عَنْ أَنَسِ بْنِ مَالِكٍ ـ رضى الله عنه ـ قَالَ قَالَ النَّبِيُّ صلى الله عليه وسلم ‏

‏ مَنْ ذَبَحَ قَبْلَ الصَّلاَةِ فَإِنَّمَا ذَبَحَ لِنَفْسِهِ، وَمَنْ ذَبَحَ بَعْدَ الصَّلاَةِ فَقَدْ تَمَّ نُسُكُهُ، وَأَصَابَ سُنَّةَ الْمُسْلِمِينَ ‏

‏‏.‏

References2 variants
In-Book Reference
Book 73, Hadith 2
USC-MSA web (English) reference
Vol. 7, Book 68, Hadith 454 (deprecated numbering scheme)