Narrated Ibn `Umar:
Allah's Messenger () said, "When the (upper) edge of the sun appears (in the morning), don't perform a prayer till the sun appears in full, and when the lower edge of the sun sets, don't perform a prayer till it sets completely. And you should not seek to pray at sunrise or sunset for the sun rises between two sides of the head of the devil (or Satan). (Bukhari 9:59)
Yahya related to me from Malik from Abdullah ibn Dinar from Abdullah ibn Umar that Umar ibn al-Khattab used to say, "Do not intend to do your prayer at either sunrise or sunset, for the horns of Shaytan rise with the rising of the sun and set with its setting."
Umar used to beat people for that kind of prayer. (Bukhari 15:49)