Comparing Genesis 1, with II Peter 3(this is how I've worked it out, perhaps there will be agreement or disagreement and that's fine:
In the beginning God created the earth, no specifics as far a time as we know it, but the earth is about 4.54 billion years old, and in the beginning God created it to be inhabited not void and without form a Isaiah says in 45:18, "For thus saith the Lord That created the heavens; God Himself That formed the earth and made it; He hath established it, He created it not in vain(meaning not void and without form in the beginning), He formed it to be inhabited(not void or empty in the beginning, but to be inhabited by Him and His sons, being you and me, all His sons in spirit bodies): "I am the Lord; and there is none else."
Peter calls this the "world that then was", and there are not many scriptures describing that world, but there are some. So this was the first generation of the earth, earth created in perfection for God and His "sons", God lived and reigned on the earth, perhaps at that time the earth was the only planet in all the universe. God surrounded it with a band of dense water, with an atmosphere to sustain flesh life, between the water band and the face of the earth, thus as Peter says "the earth being in the water and out of the water" and He was the light of that world, from the surface up. This was the time of the dinosaurs, God's spirit kingdom living in perfect unity with His flesh kingdom. Even in that generation all had freewill, why would God create robots to love Him by will, He wants our love freely given. So when a "son" took the wrong path, there was righteous judge to mete out justice, Melchisedec(God's Son, who will eventually come to earth in flesh and be sacrificed), who sat on the Mercy Seat, being guarded by the two cherubim which covereth(of which the the Ark of the Covenant was to be an example of). But one of those cherubim became jealous, filled with envy, and he caused rebellion in that heaven on earth. For the cherubim's rebellion and all the "sons" he'd deceived into following him, God sentenced the cherubim to obliteration, not in that generation, but a time in the far distant second generation of the earth, for God brings calamity(the falling of that dense water band upon the face of the earth, God's presence and light is gone, so the destructive falling of the water causes the face of the earth to go into upheaval, and then to freeze over and darkness covers the face of the earth, no flesh creature remains and He takes His "sons" to be wherever He is! Perhaps this generation of the earth lasted most of that 4.54 million years, but as it says in Genesis 1:2, "And the earth "was" without form, and void; and darkness was upon the face of the deep"(water/ice). And the Spirit of God moved upon the face of the waters(perhaps this took a couple thousand of years for the waters to be moved and the continents to appear). The word "was" is a wrong translation, the word should have been "became"(and we can document this as the same and correct use of this word became as found in Genesis 2:7, where it reads
.and man became a living soul. The Strongs Hebrew dictionary for this word is 1961, Yahah, haw-yaw; a prime root, to exit; to become, or come to pass). So, for another unspecified period of time the surface of the earth hung in utter blackness. Until God then sends the Holy Spirit to rejuvenate the face the earth, so flesh man will be born of woman for one reason alone, to make a choice to love and serve Him, or follow Satan and the things of the world. Peter says this new generation of the earth is the "world which is now". Genesis 2:4, "These are the generations of the heavens and of the earth when they were created, in the day that the LORD God made the earth and the heavens," take note of the plural of generations, so there has to be more than one! This generation of the earth for flesh is somewhere between 10-12 thousands of years old. Note: It is important to understand the use of the word foundation in scripture, it is found 54 times in 53 scriptures in the Old(30) and New Testament(23). Of those 23 New Testament uses, 10 have a meaning that are extremely important as to what had happened in these first to verses of Genesis. The phrase foundation of the world is found in Matt.13:35, 25:34, Luke 11:15, John 17:24, Eph.1:4, Heb. 4:3, 9:26, I Peter 1:20 and Rev. 13:8, 17:8, the Greek meaning, from the Strongs Concordance is G2602, katabolē, a throwing or laying down, the injection or depositing of the virile sperm in the womb, of the seed of plants and animals or a founding (laying down a foundation). This meaning comes from G2596, kataballo, to cast down, to throw to the ground, prostate, to put in a lower place, to lay (down) a foundation(as in destroy a foundation). And taken back to the prime root we have G906, ballo, to throw or let go of a thing without caring where it falls, to scatter, to throw, cast into, to give over to one's care uncertain about the result, of fluids, to pour, pour into of rivers, to pour out, and to put into, insert. So, from the meaning of foundation found in the Strongs Concordance, we must see that this is not talking about the perfect foundation of the world set at the beginning of all creation, but a throwing down, or a casting away of it, or as God stated, that first great shaking, to end the surface of the earth of His original perfect creation because it had become corrupted, and polluted with lies and deception by His adversary, the one we call Satan.