Sunan Ibn Majah 177
It was narrated that Jarir bin 'Abdullah said:
"We were sitting with the Messenger of Allah. He looked at the moon, which was full, and said, 'Indeed, you will see your Lord as you see this moon. You will not feel the slightest inconvenience and overcrowding in seeing Him. If you have the power not to be overcome and to say this prayer before the sun rises and before it sets, then do that.' Then he recited: "And glorify the praises of your Lord, before the rising of the sun and before (its) setting."
حَدَّثَنَا مُحَمَّدُ بْنُ عَبْدِ اللَّهِ بْنِ نُمَيْرٍ، حَدَّثَنَا أَبِي وَوَكِيعٌ، ح وَحَدَّثَنَا عَلِيُّ بْنُ مُحَمَّدٍ، حَدَّثَنَا خَالِي، يَعْلَى وَوَكِيعٌ وَأَبُو مُعَاوِيَةَ قَالُوا حَدَّثَنَا إِسْمَاعِيلُ بْنُ أَبِي خَالِدٍ، عَنْ قَيْسِ بْنِ أَبِي حَازِمٍ، عَنْ جَرِيرِ بْنِ عَبْدِ اللَّهِ، قَالَ كُنَّا جُلُوسًا عِنْدَ رَسُولِ اللَّهِ ﷺ فَنَظَرَ إِلَى الْقَمَرِ لَيْلَةَ الْبَدْرِ فَقَالَ " إِنَّكُمْ سَتَرَوْنَ رَبَّكُمْ كَمَا تَرَوْنَ هَذَا الْقَمَرَ لاَ تَضَامُّونَ فِي رُؤْيَتِهِ فَإِنِ اسْتَطَعْتُمْ أَنْ لاَ تُغْلَبُوا عَلَى صَلاَةٍ قَبْلَ طُلُوعِ الشَّمْسِ وَقَبْلَ غُرُوبِهَا فَافْعَلُوا " . ثُمَّ قَرَأَ {وَسَبِّحْ بِحَمْدِ رَبِّكَ قَبْلَ طُلُوعِ الشَّمْسِ وَقَبْلَ الْغُرُوبِ} .