Whoever repents before the sun rises from the west, Allah will accept his repentance
Authentic hadithعن أبي هريرة رضي الله عنه قال: قال رسول الله صلى الله عليه وسلم : «مَنْ تَابَ قَبْلَ أَنْ تَطْلُعَ الشَّمْسُ مِنْ مَغْرِبِهَا تَابَ اللهُ عَلَيْهِ».
Abu Hurayrah (may Allah be pleased with him) reported that the Prophet (may Allah's peace and blessings be upon him) said: "Whoever repents before the sun rises from the west, Allah will accept his repentance."
Explanation
This Hadīth informs us that Allah, the Almighty, accepts the repentance of His sinful servants as long as the sun has not yet risen from the west, because when this happens, it will mark the end of the time when repentance is accepted, and it is one of the major signs of the approach of the Hour.
Source · Narrated by Muslim
From the Hadith Encyclopedia (hadeethenc.com).