The Prophet ﷺ said one day, "Do you know where this sun goes?"They replied, "Allah and His Messenger know best."He said, "It travels until it reaches its resting place beneath the Throne. Then it falls down in prostration and remains so until it is told, 'Rise and return from where you came.' So it returns and rises in the morning from its rising place. Then it travels until it reaches its resting place beneath the Throne, falls down in prostration, and remains so until it is told, 'Rise and return from where you came.' So it returns and rises in the morning from its rising place. Then it travels, with people noticing nothing unusual about it, until it reaches that resting place of its beneath the Throne. Then it is told, 'Rise, and rise in the morning from your place of setting.' So it rises in the morning from its place of setting."Then the Messenger of Allah ﷺ asked, "Do you know when that will be? That will be when 'no soul will benefit from its faith if it had not believed before or earned good through its faith' [Anam 6:158]."
أن النبي ﷺ قال يوما: أتدرون أين تذهب هذه الشمس؟ قالوا: الله ورسوله أعلم، قال: إن هذه تجري حتى تنتهي إلى مستقرها تحت العرش. فتخر ساجدة، فلا تزال كذلك حتى يقال لها: ارتفعي، ارجعي من حيث جئت، فترجع، فتصبح طالعة من مطلعها، ثم تجري حتى تنتهي إلى مستقرها تحت العرش، فتخر ساجدة، ولا تزال كذلك حتى يقال لها: ارتفعي، ارجعي من حيث جئت، فترجع، فتصبح طالعة من مطلعها، ثم تجري لا يستنكر الناس منها شيئا حتى تنتهي إلى مستقرها ذاك تحت العرش. فيقال لها: ارتفعي، أصبحي طالعة من مغربك، فتصبح طالعة من مغربها. فقال رسول الله ﷺ: أتدرون متى ذاكم؟ ذاك حين {لا ينفع نفسا إيمنها لم تكن ءامنت من قبل أو كسبت في إيمنها خيرا} [سورة الأنعام: ١٥٨].
Bukhari narrated it in the Book of the Beginning of Creation (3199), and Muslim in the Book of Faith (159), both from the hadith of Ibrahim bin Yazid Taymi, from his father, from Abu Dharr, and he mentioned it. The wording given is that of Muslim, while the wording of Bukhari is abridged.