Then spoke Joshua to Yahweh in the day when Yahweh delivered up the Amorites before the children of Israel; and he said in the sight of Israel, Sun, stand you still on Gibeon; You, Moon, in the valley of Aijalon.
(3) There are other explanations, of course, which are worthy of no attention at all.  Some are variations of the above; some make use of the critical device of declaring portions of the chapter a gloss, an interpolation, or a "late addition" by some writer who misunderstood the Book of Joshua that he was revising!