Sahih Muslim Book 37, Hadith Number 6644.

Chapter : Repentance is accepted so long as one repents after committing sins.

Abu Mu’sa reported Allah’s Messenger (may peace be upon him) as saying that Allah, the Exalted and Glorious, Stretches out His Hand during the night so that the people repent for the fault committed from dawn till dusk and He stretches out His Hand daring the day so that the people may reprint for the fault committed from dusk to dawn. (He would accept repentance) before the sun rises in the west (before the Day of Resurrection). A hadith like this has been narrated on the authority of Shu’ba with the same chain of transmitters.