The Prophet ﷺ remained in Mecca for ten years, during which the Quran was being revealed to him, and in Medina for ten years.
لبث النبي ﷺ بمكة عشر سنين، ينزل عليه القرآن، وبالمدينة عشرا.
Bukhari narrated it in the Virtues of the Quran (4978, 4979) from Ubaydullah bin Musa, from Shayban, from Yahya, from Abu Salama, who said, "Ayesha and Ibn Abbas told me," and he mentioned it.Their statement, "ten years in Makkah," what is known is that he ﷺ stayed in Makkah for thirteen years, so the period of the Quran's revelation was twenty-three years. The word "ten" is a mistake by one of the narrators, or it is a rounding down, meaning dropping what was extra beyond the ten. An explicit clarification comes in the following narration.