Some thoughts on your linked Genesis passage: (Note that this all happened on the first day.}
Genesis 1:1-5
1 In the beginning God created the heavens and the earth. 2 Now the earth was formless and empty,
If any object is formless and empty how could it exist? This doesn't make sense unless it simply means the earth has yet to exist. Yet . . . .
darkness was over the surface of the deep, and the Spirit of God was hovering over the waters.
I can only assume that for waters to have a location over which the Spirit of God could hover there would have to be as a container for the water, and particularly for there to be a "deep." My guess is that this container would be the earth.
3 And God said, “Let there be light,” and there was light.
At this point the light could come from anything, anywhere.
4 God saw that the light was good, and he separated the light from the darkness. 5 God called the light “day,” and the darkness he called “night.”
Now this is a little more informative. If one is to assume that the "day" and "night" mentioned refers to the earth's day and night, then when it's said "he separated the light from the darkness" it must refer to the creation of the earth. The earth was what separated the darkness from the light.
And there was evening, and there was morning—the first day.
And here we have it. God sent the earth spinning so as to produce evening and morning.
So, which came first, the earth or the sun? Yeah got me.
If one insists that the water container was earth then the earth was created first.
If one feels that he separated the light from the darkness after having created light by placing the earth in front of the light, then the light was created first.
The people that wrote Genesis did not appear to understand that the Sun was the cause of light. They could have easily thought that the Sun was part of the day since it is rather small light in the sky, though rather intense. Genesis specifically says that the Sun was created on the 4th day:
"14 And God said, “Let there be lights in the expanse of the heavens to separate the dayfrom the night. And let them be for
isigns and for
jseasons,
6 and for days and years, 15 andlet them be lights in the expanse of the heavens to give light upon the earth.” And it was so.16 And God
kmade the two great lights—the greater light to rule the day and the lesser lightto rule the night—and the stars. 17 And God set them in the expanse of the heavens to givelight on the earth, 18 to
lrule over the day and over the night, and to separate the light fromthe darkness. And God saw that it was good. 19 And there was evening and there wasmorning, the fourth day."
At least that is how I interpret "the greater light".