We set out with the Messenger of Allah ﷺ from Medina to Mecca, and he prayed two units of prayer at a time until he returned.I asked, "How long did he stay in Mecca?"He replied, "Ten days."
خرجنا مع رسول الله ﷺ من المدينة إلى مكة، فصلى ركعتين ركعتين حتى رجع، قلت: كم أقام بمكة؟ قال: عشرا.
Bukhari narrated it in the Book of Military Expeditions (4297), and Muslim in the Book of the Prayer of Travelers (693:15), both through the route of Sufyan Thawri, from Yahya bin Abu Ishaq, from Anas, who related it.Bukhari mentioned in the Book of Military Expeditions that he stayed this length of time during the conquest of Makkah, but the correct view is that this hadith of Anas concerns the Farewell Hajj, as is found in Muslim through the route of Shubah, from Yahya bin Abu Ishaq, who said, "I heard Anas bin Malik say, 'We set out from Madinah for the Hajj...'" then he related the same account. This is the correct view, because he entered on the fourth day and left on the fourteenth day, as Ibn Hajar stated. Fath al-Bari (8/21).Bukhari, may Allah have mercy on him, mentioned the hadith in two places, one in the Book of Shortening the Prayer (1081), and the second in the Book of Military Expeditions, in the chapter on the Prophet's ﷺ stay in Makkah at the time of the conquest. Perhaps he intended by this to clarify the duration of shortening the prayer, whether that was during the conquest of Makkah or during the Farewell Hajj. Or perhaps he did not notice the discrepancy in duration between this hadith of Anas and the hadith of Ibn Abbas which he mentioned right after it, where he said, "The Prophet ﷺ stayed in Makkah for nineteen days, praying two rakahs," meaning during the conquest of Makkah. Or perhaps Bukhari, may Allah have mercy on him, simply did not have the opportunity to arrange the chapters of the Book of Military Expeditions in chronological order.