Bara bin Azib reported,

We prayed with the Prophet ﷺ facing Jerusalem for sixteen or seventeen months, then he was turned toward the Kaaba.

Bukhari 4492

Sahih

حدثنا محمد بن المثنى حدثنا يحيى عن سفيان حدثني أبو إسحاق قال سمعت

البراء رضي الله عنه قال

صلينا مع النبي ﷺ نحو بيت المقدس ستة عشر أو سبعة عشر شهرا ثم صرفه نحو القبلة

البخاري 4492صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Bukhari
Book
Tafsir
Chapter
For each is a direction to which he turns, so race to good deeds. Wherever you may be, Allah will bring you forth all together. Indeed, Allah is over all things competent
Numbering
Darussalam 4492
Bukhari 4492