Sayyiduna Abu Dharr Ghifari (may Allah be pleased with him) narrates: I asked, "O Messenger of Allah! Which mosque was built first?" The Prophet (peace and blessings be upon him) said, "Al-Masjid al-Haram, then Al-Masjid al-Aqsa." The narrator says: I asked, "What was the time span between the two?" The Prophet (peace and blessings be upon him) said, "There was a span of forty years between them. Wherever the time of prayer comes upon you, perform the prayer there; that (place) will be a mosque."
Hadith Referenceصحیح ابن حبان / كتاب الصلاة / 1598
Hadith Gradingفضيلة الشيخ الإمام محمد ناصر الدين الألبانيصحيح - «تخريج فقه السيرة» (79): ق.فضيلة الشيخ العلّامة شُعيب الأرناؤوطإسناده صحيح على شرط الشيخين.