كتاب المغازى
64  
Military Expeditions led by the Prophet (pbuh) (Al-Maghaazi)
(52)
Chapter: The stay of the Prophet (saws) in Makkah
(52)
باب مَقَامُ النَّبِيِّ صلى الله عليه وسلم بِمَكَّةَ زَمَنَ الْفَتْحِ
Sahih al-Bukhari 4299

Narrated `Ikrima:

Ibn `Abbas said, "We stayed for 19 days with Prophet on a journey during which we used to offer shortened prayers." Ibn `Abbas added, "We offer the Qasr prayer (i.e. shortened prayer) If we stay up to 19 days as travelers, But if we stay longer, we offer complete prayers.

حَدَّثَنَا أَحْمَدُ بْنُ يُونُسَ، حَدَّثَنَا أَبُو شِهَابٍ، عَنْ عَاصِمٍ، عَنْ عِكْرِمَةَ، عَنِ ابْنِ عَبَّاسٍ، قَالَ أَقَمْنَا مَعَ النَّبِيِّ صلى الله عليه وسلم فِي سَفَرٍ تِسْعَ عَشْرَةَ نَقْصُرُ الصَّلاَةَ‏.‏ وَقَالَ ابْنُ عَبَّاسٍ وَنَحْنُ نَقْصُرُ مَا بَيْنَنَا وَبَيْنَ تِسْعَ عَشْرَةَ، فَإِذَا زِدْنَا أَتْمَمْنَا‏.‏
Reference : Sahih al-Bukhari 4299
In-book reference : Book 64, Hadith 332
USC-MSA web (English) reference : Vol. 5, Book 59, Hadith 593
  (deprecated numbering scheme)