At evenfall, the battle was not yet decided, therefore Moses prayed to God that He might stay the setting of the sun and thus enable Israel to draw the battle to a close. God granted this prayer, for the sun did not set until Israel had completely destroyed their enemy. Thereupon Moses blessed Joshua with the words, "Some day the sun shall stand still for thy sake, as it did to-day for mine," and this blessing was later fulfilled at Gibeon, when the sun stood still to help Joshua in his battle against the Amorites.
Moses Prays for the Sun to Stand Still in Battle
Legends of the Jews 1:127