Hadith 504640
Chapter 14: The Qibla - كتاب القبلة
وَحَدَّثَنِي عَنْ مَالِكٍ، عَنْ يَحْيَى بْنِ سَعِيدٍ، عَنْ سَعِيدِ بْنِ الْمُسَيَّبِ، أَنَّهُ قَالَ صَلَّى رَسُولُ اللَّهِ صلى الله عليه وسلم بَعْدَ أَنْ قَدِمَ الْمَدِينَةَ سِتَّةَ عَشَرَ شَهْرًا نَحْوَ بَيْتِ الْمَقْدِسِ ثُمَّ حُوِّلَتِ الْقِبْلَةُ قَبْلَ بَدْرٍ بِشَهْرَيْنِ .
Yahya related to me from Malik from Yahya ibn Said that Said ibn al-Musayyab said, "The Messenger of Allah, may Allah bless him and grant him peace, prayed towards the Baytal-Maqdis for sixteen months after arriving in Madina. Then the qibla was moved, two months before the battle of Badr. "
Reference Muwatta Malik 504640
USC-MSA web (English) reference : Book 14, Hadith 7