كتاب الفضائل
43  
The Book of Virtues
(33)
Chapter: How Long Did The Prophet ft Stay In Makkah And Al-Madinah?
(33)
باب كَمْ أَقَامَ النَّبِيُّ صلى الله عليه وسلم بِمَكَّةَ وَالْمَدِينَةِ ‏.‏
Sahih Muslim 2353 a

'Ammar, the freed slave of Banu Hashim, reported:

I asked Ibn 'Abbas how old was he when death overtook the Messenger of Allah (ﷺ). He said: I little know that such a thing is not known to a man like you who belong to his people. He said: I asked people about it but they differed with me, and I liked to know your opinion about it. He said: Do you know counting? He said: Yes. He then said: Bear this in mind very well that he was commissioned (as a Prophet) at the age of forty, and he stayed in Mecca for fifteen years; sometime in peace and sometime in dread, and (lived) for ten years after his migration to Medina.
وَحَدَّثَنِي ابْنُ مِنْهَالٍ الضَّرِيرُ، حَدَّثَنَا يَزِيدُ بْنُ زُرَيْعٍ، حَدَّثَنَا يُونُسُ بْنُ عُبَيْدٍ، عَنْ عَمَّارٍ، مَوْلَى بَنِي هَاشِمٍ قَالَ سَأَلْتُ ابْنَ عَبَّاسٍ كَمْ أَتَى لِرَسُولِ اللَّهِ صلى الله عليه وسلم يَوْمَ مَاتَ فَقَالَ مَا كُنْتُ أَحْسِبُ مِثْلَكَ مِنْ قَوْمِهِ يَخْفَى عَلَيْهِ ذَاكَ - قَالَ - قُلْتُ إِنِّي قَدْ سَأَلْتُ النَّاسَ فَاخْتَلَفُوا عَلَىَّ فَأَحْبَبْتُ أَنْ أَعْلَمَ قَوْلَكَ فِيهِ ‏.‏ قَالَ أَتَحْسُبُ قَالَ قُلْتُ نَعَمْ ‏.‏ قَالَ أَمْسِكْ أَرْبَعِينَ بُعِثَ لَهَا خَمْسَ عَشْرَةَ بِمَكَّةَ يَأْمَنُ وَيَخَافُ وَعَشْرَ مِنْ مُهَاجَرِهِ إِلَى الْمَدِينَةِ ‏.‏
Reference : Sahih Muslim 2353a
In-book reference : Book 43, Hadith 158
USC-MSA web (English) reference : Book 30, Hadith 5805
  (deprecated numbering scheme)