What is the meaning of the 6 days in exodus 31:17 and 20:11?

It helped me understand the sabbath. But why would the author say that he created the heavens and the earth in 6 days, when the creation in fact begun before day 1