كتاب 60
60  
Book 60
(60)
Chapter 60
(60)
باب 60
Sahih al-Bukhari 3284
Narrated Abu Dhaar:
I said, "O Allah's Messenger (ﷺ)! Which mosque was built first?" He replied, "Al-Masjid-ul-Haram." I asked, "Which (was built) next?" He replied, "Al-Masjid-ul-Aqs-a (i.e. Jerusalem)." I asked, "What was the period in between them?" He replied, "Forty (years)." He then added, "Wherever the time for the prayer comes upon you, perform the prayer, for all the earth is a place of worshipping for you."
حَدَّثَنِي عُمَرُ بْنُ حَفْصٍ، حَدَّثَنَا أَبِي، حَدَّثَنَا الأَعْمَشُ، حَدَّثَنَا إِبْرَاهِيمُ التَّيْمِيُّ، عَنْ أَبِيهِ، عَنْ أَبِي ذَرٍّ ـ رضى الله عنه ـ قَالَ قُلْتُ يَا رَسُولَ اللَّهِ‏.‏ أَىُّ مَسْجِدٍ وُضِعَ أَوَّلُ قَالَ ‏"‏ الْمَسْجِدُ الْحَرَامُ ‏"‏‏.‏ قُلْتُ ثُمَّ أَىٌّ قَالَ ‏"‏ ثُمَّ الْمَسْجِدُ الأَقْصَى ‏"‏‏.‏ قُلْتُ كَمْ كَانَ بَيْنَهُمَا قَالَ ‏"‏ أَرْبَعُونَ ‏"‏‏.‏ ثُمَّ قَالَ ‏"‏ حَيْثُمَا أَدْرَكَتْكَ الصَّلاَةُ فَصَلِّ، وَالأَرْضُ لَكَ مَسْجِدٌ ‏"‏‏.‏
Reference : Sahih al-Bukhari 3284
In-book reference : Book 60, Hadith 3284
USC-MSA web (English) reference : Vol. 1, Book 1, Hadith 3284
  (deprecated numbering scheme)