كتاب الْمَسَاجِدِ وَمَوَاضِعِ الصَّلاَةِ
5  
The Book of Mosques and Places of Prayer
(2)
Chapter: Changing the qiblah from Al-Quds (Jerusalem) to the Ka`bah
(2)
باب تَحْوِيلِ الْقِبْلَةِ مِنَ الْقُدْسِ إِلَى الْكَعْبَةِ ‏
Sahih Muslim 525 b

Abu Ishaq reported:

I heard al-Bara' saying: We prayed with the Messenger of Allah (ﷺ) (with our faces) towards Bait-ul-Maqdis for sixteen months or seventeen months. Then we were made to change (our direction) towards the Ka'ba.
حَدَّثَنَا مُحَمَّدُ بْنُ الْمُثَنَّى، وَأَبُو بَكْرِ بْنُ خَلاَّدٍ جَمِيعًا عَنْ يَحْيَى، - قَالَ ابْنُ الْمُثَنَّى حَدَّثَنَا يَحْيَى بْنُ سَعِيدٍ، - عَنْ سُفْيَانَ، حَدَّثَنِي أَبُو إِسْحَاقَ، قَالَ سَمِعْتُ الْبَرَاءَ، يَقُولُ صَلَّيْنَا مَعَ رَسُولِ اللَّهِ صلى الله عليه وسلم نَحْوَ بَيْتِ الْمَقْدِسِ سِتَّةَ عَشَرَ شَهْرًا أَوْ سَبْعَةَ عَشَرَ شَهْرًا ثُمَّ صُرِفْنَا نَحْوَ الْكَعْبَةِ ‏.‏
Reference : Sahih Muslim 525b
In-book reference : Book 5, Hadith 17
USC-MSA web (English) reference : Book 4, Hadith 1072
  (deprecated numbering scheme)