Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:7:54

Indeed, your Lord is Allah, who created the heavens and earth in six days and then established Himself above the Throne. He covers the night with the day, ˹another night˺ chasing it rapidly; and ˹He created˺ the sun, the moon, and the stars, subjected by His command. Unquestionably, His is the creation and the command; blessed is Allah, Lord of the worlds.  

Surely your Lord is God, Who created the heavens and the earth in six days, of the days of this world, that is to say, in the equivalent thereof, since there was no sun then. Had He willed He could have created them in an instant; but the reason for His not having done so is that He wanted to teach His creatures to be circumspect; then presided upon the Throne, a presiding befitting of Him (al-‘arsh, ‘throne’, in the ˹classical˺ language is the elevated seat on which a king sits). He cloaks (read yughshī or yughashshī) the night with the day, that is, He covers each one with the other: each following the other in swift pursuit — and the sun and the moon and the stars (if all of these are read in the accusative, then they constitute a supplement to al-samāwāt, ‘the heavens’, and if in the nominative, then they constitute the subject of the sentence, the predicate of which follows) have been made subservient, ˹have been˺ subdued, by His command, by His power. Verily, His is, all, creation and the command, in its entirety. Blessed, Magnified, be God, the Lord, the Master, of the Worlds!
القرآن:٧:٥٤

إِنَّ رَبَّكُمُ اللَّهُ الَّذِي خَلَقَ السَّمَاوَاتِ وَالْأَرْضَ فِي سِتَّةِ أَيَّامٍ ثُمَّ اسْتَوَىٰ عَلَى الْعَرْشِ يُغْشِي اللَّيْلَ النَّهَارَ يَطْلُبُهُ حَثِيثًا وَالشَّمْسَ وَالْقَمَرَ وَالنُّجُومَ مُسَخَّرَاتٍ بِأَمْرِهِ ۗ أَلَا لَهُ الْخَلْقُ وَالْأَمْرُ ۗ تَبَارَكَ اللَّهُ رَبُّ الْعَالَمِينَ  

{إن ربكم الله الذي خلق السماوات والأرض في ستة أيام} من أيام الدنيا، أي في قدرها لأنه لم يكن ثَمَّ شمس ولو شاء خلقهم في لمحة، والعدول عنه لتعليم خلقه التثبيت {ثم استوى على العرش} هو في اللغة: سرير الملك استواء يليق به {يُغْشِي الليل النهار} مخففا ومشددا أي يغطي كلا منهما بالآخر طلبا {يطلبه حثيثا} سريعا {والشمس والقمر والنجوم} بالنصب عطفا على السماوات والرفع مبتدأ خبره {مسخرات} مذلَّلات {بأمره} بقدرته {ألا له الخلق} جميعا {والأمر} كله {تبارك} تعاظم {الله ربُّ} مالك {العالمين}.