«كان إذا كان مقيما اعتكف العشر الأواخر من رمضان وإذا سافر اعتكف من العام المقبل عشرين»
It was the practice of the Prophet (peace and blessings be upon him):
"When he (peace and blessings be upon him) was resident, he would observe i'tikaf in the last ten days of Ramadan, and when he was on a journey, he would observe i'tikaf for twenty days the following year."
Hadith Referenceصحیح الجامع الصغیر / حرف الكاف / 4775