Yeah, but the 1st day was before the sun and moon were created. Actually, I think the second day was marked before the sun and moon also, if I recall.
The sun, moon, and stars were created day 4.
Genesis 1:14 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: 15 And let them be for lights in the firmament of the heaven to give light upon the earth: and it was so. 16 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. 17 And God set them in the firmament of the heaven to give light upon the earth, 18 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. 19 And the evening and the morning were the fourth day.
So when we go back to the beginning, we see the purpose of the first day is to establish what the first day was, there was evening and morning for that first day and each day after that.
Genesis 1:1In the beginning God created the heaven and the earth.
The above is the topic. The following verses is just the beginning of how the Lord had accomplished this.
2 And the earth was without form, and void;....
That means the earth was formed yet. It did not existed at all. Then we see the existence of water, but what God created was the first day of what a day was.
...and darkness was upon the face of the deep. And the Spirit of God moved upon the face of the waters. 3 And God said, Let there be light: and there was light. 4 And God saw the light, that it was good: and God divided the light from the darkness. 5 And God called the light Day, and the darkness he called Night. And the evening and the morning were the first day.
Genesis 1:6 And God said, Let there be a firmament in the midst of the waters, and let it divide the waters from the waters. 7 And God made the firmament, and divided the waters which were under the firmament from the waters which were above the firmament: and it was so. 8 And God called the firmament Heaven. And the evening and the morning were the second day.
Now we have a water planet with an upper atmosphere that was created that second day. That was how quick that water planet was created.
Genesis 1:9 And God said, Let the waters under the heaven be gathered together unto one place, and let the dry land appear: and it was so.10 And God called the dry land Earth; and the gathering together of the waters called he Seas: and God saw that it was good.11 And God said, Let the earth bring forth grass, the herb yielding seed, and the fruit tree yielding fruit after his kind, whose seed is in itself, upon the earth: and it was so.12 And the earth brought forth grass, and herb yielding seed after his kind, and the tree yielding fruit, whose seed was in itself, after his kind: and God saw that it was good.13 And the evening and the morning were the third day.
Now we have the earth formed with the water all in one place and the one large land mass in that third day with mature plants bearing fruits and seeds.
So with the creation of the heavens that fourth day was to show also how long it took for God to create the heavens & fill in the gap with her lights to govern the earth that day.
The creation week did not end until Genesis 2:3 where God rested on the seventh day before starting the next topic in verse 4 about the generations of man and where we had all come from which is a rehashing of the event on day 6 in detail on how man was created.
So the 7 day creation including the day of rest from creation, was to establish how everything was created in 6 days for God to rest from that effort of creating the heavens and the earth on day 7.