The first chapter of Genesis tells us that God made the earth is six days. Here is what he did on the fourth day.
And God said, “Let there be lights in the expanse of the heavens to separate the day from the night. And let them be for signs and for seasons, and for days and years, and let them be lights in the expanse of the heavens to give light upon the earth.” And it was so.
It would appear that he created the rest of the universe at this time. The problem with this belief is that many of the stars are so far away that it takes millions of years for the light from them to reach the earth. Young earth creationists have come up with several explanations for this problem. You can read some of them here: Does Distant Starlight Prove the Universe Is Old?
I believe there is a different explanation. The Bible says that God placed lights in the sky; it doesn’t say he created the bodies that produced those lights at that time. I have written a post in which I explain the reasons I believe this: Young earth, old universe .
Recently someone pointed out a verse that seems to show that the whole universe was created during the creation weak.
For in six days the LORD made heaven and earth, the sea, and all that is in them, and rested on the seventh day. Therefore the LORD blessed the Sabbath day and made it holy.
The Bible speaks of more than one heaven.
I know a man in Christ who fourteen years ago was caught up to the third heaven—whether in the body or out of the body I do not know, God knows. And I know that this man was caught up into paradise—whether in the body or out of the body I do not know, God knows—and he heard things that cannot be told, which man may not utter.
2 Corinthians 12:2-4
Paradise, God’s dwelling place, is here called the third heaven. If that is so then the second heaven must be outer space where the stars are and the first must be the earth’s atmosphere. The first heaven is specifically mentioned in the creation account.
And God said, “Let there be an expanse in the midst of the waters, and let it separate the waters from the waters.” And God made the expanse and separated the waters that were under the expanse from the waters that were above the expanse. And it was so. And God called the expanse Heaven. And there was evening and there was morning, the second day.
Some translations of the Bible use the word sky instead of heaven but the Hebrew word normally translated as heaven is used here.
The word “earth” has two meanings. It can refer to our planet or it can mean dry land. Here is how it is used in the creation account.
And God said, “Let the waters under the heavens be gathered together into one place, and let the dry land appear.” And it was so. God called the dry land Earth, and the waters that were gathered together he called Seas. And God saw that it was good.
Exodus 20:11 could be translated like this: “In six days the LORD made the air, the land, and the sea.” If you study it carefully you will find that it doesn’t contradict the belief that only the earth was created in the six days.