The 4th of the 40 hadiths gathered by Various compilers in Forty Hadith Qudsi, given below in the original Arabic with an English translation and its reference.
On the authority of Abu Hurayrah (may Allah be pleased with him), who said that the Messenger of Allah (ﷺ) said: Allah said: Sons of Adam inveigh against [the vicissitudes of] Time, and I am Time, in My hand is the night and the day (1). (1) As the Almighty is the Ordainer of all things, to inveigh against misfortunes that are part of Time is tantamount to inveighing against Him. It was related by al-Bukhari (also by Muslim)
Sunni collections: text from the open hadith-api dataset. Al-Kafi: Arabic text, Muhammad Sarwar's translation and gradings from Thaqalayn.net via the Thaqalayn API. Hadith numbering follows those editions and can differ from a printed copy — check the Arabic against a trusted edition before relying on a reference.