T
he fourth day of creation
The Biblical account of the creation says that on the fourth day God said:
“Let there be lights in the expanse of the sky to separate the day from night; they shall serve as signs for the set times – the days and the years; and they shall serve as lights in the expanse of the sky to shine upon the earth. And it was so. God made the two great lights, the greater light to dominate the day and the lesser light to dominate the night, and the stars. And God set them in the expanse of the sky to shine upon the earth, to dominate the day and the night, and to separate light from darkness. And God saw that this was good. And there was evening and there was morning, a fourth day”. Genesis 1:14 – 19. The Jewish Bible.
There is uncertainty in science as to the exact dates of the creation of each of the earth, moon, sun, stars, and planets. There is also uncertainty, as to their chronological order. For example, I have found articles that say the earth was formed 4.54 billion years ago. But even these show how uncertain the dating is. https://www.space.com/24854-how-old-is-earth.html .
The moon is believed to be about 4.51 billion years old. https://www.space.com/35291-moon-age-pinned-down.html . Just slightly younger than the earth. Again the years are so close that nothing an be sure. However, it is widely believed that the moon was formed when a Mars sized planet called Theia, collided with the early earth, and some of the debris coalesced and formed the moon.
Articles about the sun show that it was formed about 4.5 billion years ago. More precisely about 4.57 billion years ago. https://www.scienceabc.com/nature/universe/how-old-is-the-sun.html . See also https://www.worldatlas.com/articles/how-old-is-the-sun.html . About the age of the earth or maybe a little older. However, the closeness of the time frame with such a vast time frame, makes it virtually uncertain to be exact.
Bottom line is that earth certainly predated the moon according to science and the bible. Even though science dates the sun around the same time as the earth, and maybe a little earlier, it is not certain. I do not have an answer from science clearly showing Moses was correct, but since science is not entirely clear, and the timing of both is so close, we can leave that out for future study and not necessarily discount the bible’s timing.