'Abdullah bin Abu Aufa (May Allah be pleased with him) reported:
The Messenger of Allah (ﷺ) at one time when he confronted the enemy, and was waiting for the sun to set, stood up and said, "O people! Do not long for encountering the enemy and supplicate to Allah to grant you security. But when you face the enemy, show patience and steadfastness; and keep it in mind that Jannah lies under the shade of the swords." Then he invoked Allah, saying, "O Allah, Revealer of the Book, Disperser of the clouds, Defeater of the Confederates, put our enemy to rout and help us in over-powering them".[Al- Bukhari and Muslim].
Arabic/English book reference: Book 1, Hadith 53