Tafseer of the verse “Indeed your Lord is Allah, Who created the heavens and the earth in Six Days” [al-A‘raaf 7:54] and a discussion about the length of the day in this case
Question

“Indeed your Lord is Allah, Who created the heavens and the earth in Six Days, and then He Istawa (rose over) the Throne (in a manner that befits His Majesty)…” [al-A‘raaf 7:54].
It is well-known that the definition of a day is the time it takes for the earth to complete one rotation on its axis, which results in the alternation between night and day.
In other words: when the sun rises and sets, then comes bacj again, then it has completed one day.
The verse quoted above mentions six days; how was this measured if there was no earth and no sun?
Praise be to Allah.Allah, may He be exalted, says (interpretation of the meaning)
“Indeed your Lord is Allah, Who created the heavens and the earth in Six Days, and then He Istawa (rose over) the Throne (really in a manner that suits His Majesty)” [al-A‘raaf 7:54]
“And indeed We created the heavens and the earth and all between them in six Days and nothing of fatigue touched Us”
[Qaaf 50:38]. 
This does not necessarily mean that the length of the day was determined by the movement of heavenly bodies, or by the sun and moon and the like; that only has to do with the length of days in this world, according to what people know. But before Allah created the sun and moon, there can only have been other standards for measuring time and determining the length of days. In fact we now know that what is known as the light year is completely different from the year that people know, but no one judges the one who speaks of that as being mistaken, or says to him: Your year is not correct and is not known. 
Ibn al-Jawzi (may Allah have mercy on him) said: 
What is meant by the words “in Six Days” is the equivalent of that, because the day is known by the rising and setting of the sun, but there was no sun at that time…
End quote from Zad al-Maseer (3/211) 
Shaykh al-Islam Ibn Taymiyah (may Allah have mercy on him) said: 
Here Allah, may He be glorified, tells us that He created the heavens and the earth in six days. It is all the same whether it is said that those days were of the same length as the days that are determined by the rising and setting of the sun, or it is said that they were longer than that, as some scholars said that each day was the equivalent of a thousand years – because there can be no doubt that those days in which the heavens and the earth were created were different from these days and were different from time which is measured by the movement of these heavenly bodies. those days were measured by the movement of other bodies that existed before the creation of the heavens and the earth.
End quote from Majmoo‘ al-Fatawa (18/235) 
He also said: 
Allah tells us that He created the heavens and the earth and all that is between them in six days; those days were a period of time that was measured by a movement other than the movement of the sun and moon.
End quote from Dar’ Ta‘aarud al-‘Aql wa’n-Naql (1/69) 
And Allah knows best.