Accepting the creation tale as literal 6 days, here are some facts.
The Hebrew calendar is a lunisolar calendar, meaning that months are based on lunar months, but years are based on solar years. A day in Hebrew calendar is counted from sunset to the next sunset. Sunset is the starting point for a new day but night time is considered as the transition period between the two days , therefore, morning (sunrise) is mostly called as the start of a day.
Genesis 1:1-5 (NIV) In the beginning God created the heavens and the
earth. Now the earth was formless and empty, darkness was over the
surface of the deep, and the Spirit of God was hovering over the
waters. And God said, “Let there be light,” and there was light.
God saw that the light was good, and he separated the light from the
darkness. God called the light “day” and the darkness he called
“night.” And there was evening, and there was morning—the first
day.
As we see in Genesis 1:3-5, light was the first thing that God created, which means that the sun was the first creation. This made it possible to start counting the time based on the sun. That is why the creation of the sun (light) was marked as the first day, and literally, the first day on this earth. Here we have to remember that the earth itself was already there but it was without light. The creation of light could also mean that the sun was already there but was not visible from earth. Therefore, the moment there was light on the surface of the earth, the counting of time based on the sun was also started. On the first day, the sun might not be clearly visible yet from the earth but the sunlight could penetrate the atmosphere and it was possible to start counting the days based on evening and morning. God is not controlled by any time measurement but since the book of Genesis was written for human and since it is about the creation of this world, it is more likely that human time measurement was used for narrating the creation story.
Genesis 1:31 (NIV) God saw all that he had made, and it was very good.
And there was evening, and there was morning—the sixth day.
After creating the sun, God continued to create land, animals and lastly, human. God finished his work on the sixth day, which is here again counted based on evening and morning.
If we take the scripture literally as it is, then we can say that God created the world in six days.