4 days had past before The Lord created the sun, moon and stars. Th first light determines the day and night also
Genesis 1:1,3,14-19 KJV
 In the beginning God created the heaven and the earth.  And God said, Let there be light: and there was light.  And God said, Let there be lights in the firmament of the heaven to divide the day from the night; and let them be for signs, and for seasons, and for days, and years:  And let them be for lights in the firmament of the heaven to give light upon the earth: and it was so.  And God made two great lights; the greater light to rule the day, and the lesser light to rule the night: he made the stars also.  And God set them in the firmament of the heaven to give light upon the earth,  And to rule over the day and over the night, and to divide the light from the darkness: and God saw that it was good.  And the evening and the morning were the fourth day.
Just something for you to consider. If you examine Gen verse 2:1 relating to everything being created and good it will tell you that the heaven and earth was completed and the "hosts". Hosts usually relates to angelic beings like the cherubs and so forth being depicted in masculine form. However the English translation added the pronoun them at the end of the verse which kind of taken away the question if host is specifically relating to angels. Bear in mind that these beings were also creation of YHWH not of the dust but of the substance of YHWH in giving off fire emitting light and were beautiful. I say this to point out that the first light which is not the sun when examining the verse it would appear as if the verb to exist in the Hebrew word Yehi is saying let he exist as light. Usually, in relating to a thing the verb would have been in its feminine form as Haya. This would give the assumption that the light was possibly an angel giving off a very powerful bright light. However, a professor of mind in ancient language indicate that the masculine form of the verb is applied figuratively in a grammatical rule of when applied to an unidentified third person because English translators would not have expect that a being would literally exist as light thus the translation let there be light instead of let he be light. On the counter side if YHWH literally meant to create an angel giving off light the structure of the Hebrew sentence would not have been different except that there may have been a previous or subsequent sentence to indicate that angels or and angel was made at that point of the first light. That's a speculation though. Remember Cherubium were put in place to guard the garden.
One theory could be that first light on the first day was a beautiful angel/Cherub to serve man with light etc but by the time man was made that first light was no more hence the creation of the sun on the fourth day, then came the cunning cherub like feature with wings that YHWH removed because it deceived Eve.