Sayyiduna Abdullah bin Abbas (may Allah be pleased with them both) narrates: "The Messenger of Allah (peace and blessings be upon him) and his Companions (may Allah be pleased with them) prayed facing Bayt al-Maqdis for sixteen months; then after that the qiblah was changed."
Related hadith on this topic