The Prophet ﷺ said, "Allah the Exalted said, 'The son of Adam offends Me by cursing time, for I am time. In My hand is the command, and I alternate the night and the day.'"In another wording, "Allah said, 'The son of Adam offends Me when he says, "What a wretched time!" Let none of you say, "What a wretched time!" for I am time. I alternate its night and its day, and when I will, I shall seize them both.'"
قال النبي ﷺ: قال الله تعالى: يؤذيني ابن آدم يسب الدهر، وأنا الدهر، بيدي الأمر، أقلب الليل والنهار وفي لفظ: قال الله عز وجل: يؤذيني ابن آدم يقول: يا خيبة الدهر فلا يقولن أحدكم: يا خيبة الدهر فإني أنا الدهر، أقلب ليله ونهاره، فإذا شئت قبضتهما.
Bukhari narrated it in Kitab al-Tawhid (7491), and Muslim in the chapter on wordings from al-Adab (2246:2), both through routes from Sufyan, from Zuhri, from Saeed bin Musayab, from Abu Hurairah, and he mentioned it. The first wording belongs to Bukhari, and the second wording was narrated by Muslim (2246:3) through the route of Maamar, from Zuhri, with the same content. Muslim gave extensive coverage of its routes and wordings.