كتاب الإيمان
1  
The Book of Faith
(72)
Chapter: Clarifying the time when faith will no longer be accepted
(72)
باب بَيَانِ الزَّمَنِ الَّذِي لاَ يُقْبَلُ فِيهِ الإِيمَانُ ‏‏
Sahih Muslim 157 a

It is narrated on the authority of Abu Huraira that the Messenger of Allah (ﷺ) said:

The (Last) Hour shall not came till the sun rises from the place of its setting And on the day when it rises from the place of its setting even if all the people together affirmed their faith, it would not be of any avail to one who did not believe previously and derived no good out of his belief.
حَدَّثَنَا يَحْيَى بْنُ أَيُّوبَ، وَقُتَيْبَةُ بْنُ سَعِيدٍ، وَعَلِيُّ بْنُ حُجْرٍ، قَالُوا حَدَّثَنَا إِسْمَاعِيلُ، - يَعْنُونَ ابْنَ جَعْفَرٍ - عَنِ الْعَلاَءِ، - وَهُوَ ابْنُ عَبْدِ الرَّحْمَنِ - عَنْ أَبِيهِ، عَنْ أَبِي هُرَيْرَةَ، أَنَّ رَسُولَ اللَّهِ صلى الله عليه وسلم قَالَ ‏ "‏ لاَ تَقُومُ السَّاعَةُ حَتَّى تَطْلُعَ الشَّمْسُ مِنْ مَغْرِبِهَا فَإِذَا طَلَعَتْ مِنْ مَغْرِبِهَا آمَنَ النَّاسُ كُلُّهُمْ أَجْمَعُونَ فَيَوْمَئِذٍ لاَ يَنْفَعُ نَفْسًا إِيمَانُهَا لَمْ تَكُنْ آمَنَتْ مِنْ قَبْلُ أَوْ كَسَبَتْ فِي إِيمَانِهَا خَيْرًا ‏"‏ ‏.‏
Reference : Sahih Muslim 157a
In-book reference : Book 1, Hadith 301
USC-MSA web (English) reference : Book 1, Hadith 294
  (deprecated numbering scheme)