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:39:5

He created the heavens and earth in truth. He wraps the night over the day and wraps the day over the night and has subjected the sun and the moon, each running ˹its course˺ for a specified term. Unquestionably, He is the Exalted in Might, the Perpetual Forgiver.  

He created the heavens and the earth with the truth (bi’l-haqqi is semantically connected to khalaqa, ‘He created’). He turns the night into day, so that it grows, and turns the day into night, so that it grows, and He has disposed the sun and the moon, each running, in its course, for an appointed term, until the Day of Resurrection. Verily it is He Who is the Mighty, Whose way ˹always˺ prevails, Requiter of His enemies, the ˹ever˺ Forgiving, of His friends.
القرآن:٣٩:٥

خَلَقَ السَّمَاوَاتِ وَالْأَرْضَ بِالْحَقِّ ۖ يُكَوِّرُ اللَّيْلَ عَلَى النَّهَارِ وَيُكَوِّرُ النَّهَارَ عَلَى اللَّيْلِ ۖ وَسَخَّرَ الشَّمْسَ وَالْقَمَرَ ۖ كُلٌّ يَجْرِي لِأَجَلٍ مُسَمًّى ۗ أَلَا هُوَ الْعَزِيزُ الْغَفَّارُ  

{خلق السماوات والأرض بالحق} متعلق بخلق {يكوّر} يدخل {الليل على النهار} فيزيد {ويكور النهار} يدخله {على الليل} فيزيد {وسخَّر الشمس والقمر كل يجري} في فلكه {لأجل مسمى} ليوم القيامة {ألا هو العزيز} الغالب على أمره المنتقم من أعدائه {الغفار} لأوليائه.