The Prophet ﷺ remained in Mecca for ten years, during which the Qur'an used to be revealed to him; and he stayed in Medina for ten years.
أَخْبَرَتْنِي عَائِشَةُ وَابْنُ عَبَّاسٍ ؓ قَالاَ لَبِثَ النَّبِيُّ ﷺ بِمَكَّةَ عَشْرَ سِنِينَ يُنْزَلُ عَلَيْهِ الْقُرْآنُ وَبِالْمَدِينَةِ عَشْرَ سِنِينَ