Sahih Muslim , Book 15, Hadith 4075 (USC-MSA)

lbn 'Umar reported: When Allah's Apostle came back from the Battle of Hunain, Umar asked Allah's Messenger about the vow he had taken during the days of Ignorance that he would observe I'tikaf for a day. The rest of the hadith is the same.

وَحَدَّثَنَا عَبْدُ بْنُ حُمَيْدٍ، أَخْبَرَنَا عَبْدُ الرَّزَّاقِ، أَخْبَرَنَا مَعْمَرٌ، عَنْ أَيُّوبَ، عَنْ نَافِعٍ، عَنِ ابْنِ عُمَرَ، قَالَ لَمَّا قَفَلَ النَّبِيُّ صلى الله عليه وسلم مِنْ حُنَيْنٍ سَأَلَ عُمَرُ رَسُولَ اللَّهِ صلى الله عليه وسلم عَنْ نَذْرٍ كَانَ نَذَرَهُ فِي الْجَاهِلِيَّةِ اعْتِكَافِ يَوْمٍ ‏.‏ ثُمَّ ذَكَرَ بِمَعْنَى حَدِيثِ جَرِيرِ بْنِ حَازِمٍ ‏.‏

sunnah.com