The LORD was helping the Israelites defeat the Amorites that day. So about midday, Joshua prayed to the LORD loud enough for the Israelites to hear:
“Our LORD, make the sun stop
in the sky over Gibeon,
and the moon stand still
over Aijalon Valley.”
So the sun and the moon
stopped and stood still
until Israel defeated its enemies.
This poem can be found in The Book of Jashar . The sun stood still and didn't go down for about a whole day.