From Breishit Rabbah (22:13):
"And Cain went out from before God" (Genesis 4:16) - R' Hama in the name of R' Hanina son of R' Yitzchak said: [Cain] went out happy ... Adam ran into him and said to him: "What was your judgment?" [Cain] said: "I repented and [my punishment] was commuted." Adam slapped himself in the face, and said: "Such is the power of repentance, and I did not know it?" Immediately Adam stood and recited: "A song of praise for the Sabbath day: It is good 'lehodot' [=to thank or to confess to] God..." (Psalms 92)
Why does Adam's song refer to the Sabbath day? Because as the rabbis say elsewhere, not only was Adam created on the sixth day, but he sinned on the very day he was created. He could have immediately repented and entered Shabbat purified from his sin. Adam missed this initial opportunity. But once he learned about repentance, he took himself back to the moment of his sin and welcomed Shabbat while repenting.
This midrash seems especially appropriate as we enter the Shabbat of Yom Kippur. Not only is it the special day of atonement for the Jewish people, but it commemorates the occasion on which all of humanity learned about repentance and forgiveness.