Genesis chapter 1 reads, "1 In the beginning God created the heavens and the earth. 2 The earth was formless and void, and darkness was over the surface of the deep, and the Spirit of God was moving over the surface of the waters. 3 Then God said, "Let there be light"; and there was light. 4 God saw that the light was good; and God separated the light from the darkness. 5 God called the light day, and the darkness He called night. And there was evening and there was morning, one day."
I read these opening verses of Genesis and came up with a very interesting interpretation. It goes thus - when God said "let there be light" he meant let the things he was working on - in the physical realm - be visible to the members of the heavenly realm. That has to be it, because there was no Sun yet to generate light.
Verses 14 to 19 of Genesis read, "14 Then God said, "Let there be lights in the expanse of the heavens to separate the day from the night, and let them be for signs and for seasons and for days and years; 15 and let them be for lights in the expanse of the heavens to give light on the earth"; and it was so. 16 God made the two great lights, the greater light to govern the day, and the lesser light to govern the night; {He made} the stars also. 17 God placed them in the expanse of the heavens to give light on the earth, 18 and to govern the day and the night, and to separate the light from the darkness; and God saw that it was good. 19 There was evening and there was morning, a fourth day."
As you can see, the Sun was created later, on the fourth day, so that means the light he spoke of first was not the light from the Sun!
Also notice that there were no beings that needed light - save the plants - until after he created the Sun. See verses 9 to 13, which read, "9 Then God said, "Let the waters below the heavens be gathered into one place, and let the dry land appear"; and it was so. 10 God called the dry land earth, and the gathering of the waters He called seas; and God saw that it was good. 11 Then God said, "Let the earth sprout vegetation, plants yielding seed, {and} fruit trees on the earth bearing fruit after their kind with seed in them"; and it was so. 12 The earth brought forth vegetation, plants yielding seed after their kind, and trees bearing fruit with seed in them, after their kind; and God saw that it was good. 13 There was evening and there was morning, a third day."
My take is God told the angels he was going to create another realm, and wanted them to see what he was working on. Hence the command, "let there be light". He was drawing back the curtains with that command. He'd already formed the Earth, work had begun, and when he let the others see what was happening, that formed the first earth day. That was when Earth's history started, when the Heavens started talking about us. There's no history without commentary.
God continued his work after he'd "pulled back the curtains". He made the sky in day 2. The angels were still watching. He made the seas and land and vegetation in day 3 (as seen from the verse above). The plants he created got a rest from work on there first night, as there was no Sun to provide fuel for photosynthesis. But work started the next day as he created the Sun on day 4. He also made the moon and the other stars.
On day 5 he created the first physical beings that needed light to move around and function - i.e. the fish and the birds. He couldn't have created them a day earlier, you see. Day 6 saw him creating the rest of the beings to occupy the earth realm, animals to inhabit the earth, and the crowning glory of all his work, us. The angels had been watching the whole scenario. They must have wondered why God was going through all this trouble for this being "moulded from clay". No wonder one of them got jealous, and decided to undo all God had done. But that begs the questions - had Adam not sinned, how would creation have unfolded?