How long did God take to create the world?
You ask how long God took to create the earth. This is a question we cannot answer with absolute certainty. The first chapter of Genesis tells us that God created the world in 6 days. Some people say that that means 6 days of 24 hours each as we know them today and this is quite possible. God is all-powerful and can do anything. On the 7th day God rested and gave us the example of having one day in seven, set aside for rest from ordinary work and to worship the Lord.
Other people say that the six days spoken of, represent stages - larger periods of even millions of years when God created the world in an orderly way. They point out that the sun and moon which we use for telling the time was only created on the fourth day. Time is not relevant to God (1 Peter 3:8). His seventh day has not yet ended.
The important thing for us to remember is that every part of the creation was God's direct work. There is no suggestion in the Bible that things developed on their own.