Genesis 1:14-18: “And God said, “Let there be lights in the vault of the sky to separate the day from the night, and let them serve as signs to mark sacred times, and days and years, and let them be lights in the vault of the sky to give light on the earth.” And it was so. God made two great lights—the greater light to govern the day and the lesser light to govern the night. He also made the stars. God set them in the vault of the sky to give light on the earth, to govern the day and the night, and to separate light from darkness. And God saw that it was good.”
At the end of each day of the creation, we read the phrase “evening and morning, the first/second/third/fourth/fifth/or sixth day.” Today we think of day as being the full rotation of the earth. We measure it by the rising and setting of the sun. We know, of course, that the sun does not rise or set, but it appears to be doing so based on our view here from the earth. If there was no sun, we would still have the earth’s rotation. Rotation, not daylight, is the measure of a day. Moreover, before the sun was created on the 4th day, there was still a source of light. In Genesis 1:3, God said “Let there be light.” This was a physical light, not something metaphorical. There are many other forms of light such as ultraviolet and infrared, among others. We do not fully know where this source of light came from, but we do know light was there. Some say the source of light was from God himself because God is light (1 John 1:5). We do not need light to define the length of a day; we only need the earth’s rotation. More information can be found here.