"Sometimes he performed Ghusl at the beginning of the night and sometimes he performed Ghusl at the end." I said: "Praise be to Allah Who has made the matter flexible."
Sunan an-Nasa'i Book 1, Hadith 223