God did not create the sun on fourth day. Repeat . . . God did not create the sun on the fourth day.
Read Genesis 1:1.
Read it again.
Sometimes unfamiliarity with Hebrew terms and their meanings causes not a little confusion. For instance, at Genesis 1:1, the account states simply: In the beginning, God created the heavens and the earth. The verb here rendered "create" is bara, meaning: to create (surprise), to bring in something new. The heavens include all celestial bodies, and that includes the sun and moon. From here on out, however, the Genesis account describes the preparation of earth for habitation.
In Genesis 1:16, however, when speaking of the sun, the Hebrew word is not bara, but rather asah which means, to ordain, prepare, thus at this juncture, God is not creating luminaries but rather is preparing them for their purpose in relation to the earth. It should also be noted that the first mention of light uses the Hebrew word ohr meaning light in a general sense. In the second instance, the Hebrew word is maohr, referring to a source of light.
Oftentimes what appear to be contradictions or error on the surface can readily be understood if given more than a cursory reading. Sometimes a little research and investigation penetrates the swaddling bands of confusion, just like on the first day when God caused diffused light to penetrate the swaddling bands around earth.
Hannah J Paul
The Hebrew Scriptures (commonly referred to as the Old Testament)
Insight on the Scriptures - Volume I (Bible Encyclopedia published by Watchtower Bible & Tract Society)