Why did Allah create the heavens and the earth in six days when He is able to have created it in less time?
Question

If Allah intends a thing, his only word is "BE" and it is. can you please explain why he took 6 days to create the heavens and earth?.
Praise be to Allah.One of the firm beliefs held by people of deep faith and complete Tawheed is that the Lord, may He be exalted, is able to do all things, and His power is without limits. He has absolute power, perfect will and ultimate control of all affairs. If He wills a thing, it happens as He wills it at the time when He wills it, and in the manner that He wills. 
There are many definitive texts in the Book of our Lord and in the Sunnah of His Prophet (peace and blessings of Allah be upon him) which affirm this and state it clearly, with no ambiguity. It is sufficient here for us to quote some of the verses that indicate this, such as the verses (interpretation of the meaning): 
“The Originator of the heavens and the earth. When He decrees a matter, He only says to it : ‘Be!’ — and it is”
[al-Baqarah 2:117]
Al-Haafz Ibn Katheer said in his commentary on this verse (Tafseer 1/175): “Here Allah explains the completeness of His power and the greatness of His authority, and that if He wills and decrees something, He simply says to it, ‘Be!’ – just once – and it is, i.e., it comes into existence as He willed it. This is like the verse in which Allah says (interpretation of the meaning): 
‘Verily, His Command, when He intends a thing, is only that He says to it, “Be!” —  and it is!’
[Ya-Seen 36:82].” 
And Allah says (interpretation of the meaning): 
“When He has decreed something, He says to it only: ‘Be!’ — and it is” [Aal ‘Imraan 3:47]
“It is He Who gives life and causes death. And when He decides upon a thing He says to it only: ‘Be’ —  and it is” [Ghaafir 40:68]
“And Our Commandment is but one as the twinkling of an eye” [al-Qamar 54:50]
Al-Haafiz Ibn Katheer said in his commentary on this verse (4/261): “Here Allah tells us how His will is executed in His creation, and how His decree is implemented. ‘And Our Commandment is but one’ means, We only issue a command once, and We do not need to repeat it a second time, and what We command happens in the twinkling of an eye, it is not delayed for an instant. How well the poet put it: 
‘When Allah wills something, all He says to it is “Be!”, once, and it is.’” 
And there are many other verses which speak of this matter and explain it. 
Once this is established, then why did Allah create the heavens and the earth in six days? 
Firstly: 
It is narrated in more than one verse of the Book of our Lord that Allah created the heavens and the earth in six days. For example, Allah says (interpretation of the meaning): 
“Indeed, your Lord is Allah, Who created the heavens and the earth in Six Days, and then He rose over (Istawa) the Throne (really in a manner that suits His Majesty)”
[al-A’raaf 7:54]
 Secondly: 
There is nothing that Allah does but there is great wisdom in it. This is one of the meanings of Allah’s name al-Hakeem (The Most Wise). Allah may or may not show this wisdom to us, and those who have deep knowledge may understand it, to the exclusion of others. 
But the fact that we may not know or understand this wisdom should not make us deny it or object to the rulings of Allah, or try to ask too much about this wisdom that Allah has hidden from us. Allah says (interpretation of the meaning): 
 
“He [Allah] cannot be questioned as to what He does, while they will be questioned”
[al-Anbiya’ 21:23]
Some scholars have attempted to explain the reason why the heavens and the earth were created in six days: 
1 – Imam al-Qurtubi (may Allah have mercy on him) said in al-Jaami’ li Ahkaam al-Qur’aan, commenting on al-A’raaf 7:54 (4/7/140):
 “Allah mentions this period – i.e. six days – although if He had wanted to create it in an instant, He could have done so, because He is Able to say to it ‘Be!’ and is. But He wanted to: 
-Teach His slaves kindness and deliberation in their affairs.
-Manifest His power to the angels step by step.
-And there is another reason: He wanted to create it in six days because Allah has decreed a course for everything, for which reason He He delays the punishment for the sinners, because everything has an appointed time with Him.”
2 – Ibn al-Jawzi said in his tafseer called Zaad al-Maseer (3/162), commenting on the verse in Soorat al-A’raaf: 
“If it is said, why did He not create it in an instant when He is Able to do so? There are five answers to this question: 
(i)He wanted to create something each day to show His power to the angels and those who witnessed it. This was suggested by Ibn al-Anbaari.
(ii) He was preparing things for Adam and his offspring before Adam existed, to emphasize Adam’s high standing before the angels.
(iii) Doing things in a short time is more indicative of power, and deliberation is more indicative of wisdom. Allah wanted to manifest His wisdom in that, just as He manifested His power when He said, ‘ “Be!” And it is.’
(iv) He taught deliberation to His slaves, because if the One Who does not make mistakes created the universe in a deliberate manner, then it is more appropriate for those who are vulnerable to making mistakes to do things in a deliberate manner.
(v) Creation was accomplished step by step, lest anyone think that this happened as the result of an accident of nature.
3 – al-Qaadi Abu’l-Sa’ood said in his commentary on the verse in al-A’raaf (3/232):  
“The fact that Allah created things in stages although He is able to have created everything in one go is indicative of the Divine Will and is a sign of His power for those who understand, and it encourages deliberation in all things.”
And he said in his commentary on al-Furqaan 25:59 (6/226): 
“The One Who created these great stars in this precise configuration in stages, even though He is able to create them in one go, (that was) for a great reason and sublime purpose, which human minds cannot comprehend fully.”  
Based on the above, it is clear that Allah has absolute power, ultimate will and perfect control, and He has wise reasons for everything that He creates, which no one knows but He, may He be exalted. Now you can understand some of the reasons why Allah created the heavens and the earth in six days when He is able to have created them simply by saying “Be!”. 
May Allah send blessings and peace upon our Prophet Muhammad and upon his family and companions.