Ammar reported,

I asked Ibn Abbas, "How old was the Messenger of Allah ﷺ when he died?"He replied, "I did not think someone like you, from among his own people, would be unaware of that."I said, "I have asked people and received conflicting answers, so I wanted to know your view on the matter."He asked, "Can you do the arithmetic?"I said, "Yes."He said, "Hold on to forty. He was sent as a prophet at that age, then fifteen years in Mecca during which he experienced both safety and fear, and ten years from his migration to Medina."

Muslim 6100

Sahih

و حدثني ابن منهال الضرير حدثنا يزيد بن زريع حدثنا يونس بن عبيد

عن عمار مولى بني هاشم قال

سألت ابن عباس كم أتى لرسول الله ﷺ يوم مات فقال ما كنت أحسب مثلك من قومه يخفى عليه ذاك قال قلت إني قد سألت الناس فاختلفوا علي فأحببت أن أعلم قولك فيه قال أتحسب قال قلت نعم قال أمسك أربعين بعث لها خمس عشرة بمكة يأمن ويخاف وعشر من مهاجره إلى المدينة

مسلم 6100صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Muslim
Book
Virtues
Chapter
How long the Prophet ﷺ stayed in Makkah and Madinah
Numbering
Darussalam 6100
Muslim 6100