The Messenger of Allah ﷺ remained in Mecca for ten years during which the Quran was revealed to him, and in Medina for another ten.
حدثنا حسن حدثنا شيبان عن يحيى قال وأخبرني أبو سلمة
أن رسول الله ﷺ لبث بمكة عشر سنين ينزل عليه القرآن وبالمدينة عشرا
Its isnad is sahih. Yahya is Ibn Abu Kathir. The hadith is in Ibn Kathir's history 5:257, where he stated that Bukhari narrated it from Abu Naeem from Shayban, and said that Muslim did not include it. See 2640.