The Messenger of Allah ﷺ said, "None of you should deliberately time his prayer to coincide with the rising of the sun or its setting."
أخبرنا قتيبة بن سعيد عن مالك عن نافع
أن رسول الله ﷺ قال لا يتحر أحدكم فيصلي عند طلوع الشمس وعند غروبها
Bukhari narrated it in the Book of Prayer Times, Chapter on Not Deliberately Timing Prayer Before Sunset, hadith no. 585, and Muslim in the Book of the Traveler's Prayer, Chapter on the Times During Which Prayer Is Prohibited, hadith no. 828, from the hadith of Malik through this same chain, and it is found in Muwatta (Yahya's version), 1/220.