Sayyiduna Abu Dharr (may Allah be pleased with him) said: I asked: O Messenger of Allah, which mosque was built first on the earth? He (peace and blessings be upon him) said: "Al-Masjid al-Haram." I said: Then which? He (peace and blessings be upon him) said: "Al-Masjid al-Aqsa." I asked: How long was there between them? He (peace and blessings be upon him) said: "Forty years. Wherever the time of prayer comes upon you, pray there, for that is a mosque."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 4263