In this narration itsays that this is sahih but I don't know if all scholars think the same.
A sound tradition from the Messenger of God told us by Hannad b. al-Sari, who also said that he read all of the hadith (to Abu Bakr)- Abu Bakr b. 'Ayyash- Abu Sa'd al-Baqqal- 'Ikrimah- Ibn Abbas: The Jews came to the Prophet and asked him about the creation of the heavens and the earth. He said: God created the earth on Sunday and Monday. He created the mountains and the uses they possess on Tuesday. On Wednesday, He created trees, water, cities and the cultivated barren land. These are four (days). He continued (citing the Qur'an): 'Say: Do you really not believe in the One Who created the earth in two days, and set up others like Him? That is the Lord of the worlds. He made it firmly anchored (mountains) above it and blessed it and decreed that it contain the amount of food it provides, (all) in four days, equally for those asking'- for those who ask. On Thursday, He created heaven. On Friday, He created the stars, the sun, the moon, and the angels, until three hours remained. In the first of these three hours He created the terms (of human life), who would live and who would die. In the second, He cast harm upon everything that is useful for mankind. And in the third, (He created) Adam and had him dwell in Paradise. He commanded Iblis to prostrate himself before Adam, and He drove Adam out of Paradise.....
(Al-Tabari, Abu Ja’far, Tarikh ar-Rusul wal Muluk, Vol.1, 22)
Now there is already a question about this hadith on this site but there is no answer for it so I wanted to post it again since it was bothering me too. Maybe someone will answer this time. If this is sound, how do we understand this? We know that Sun and stars etc were created way before Earth was created. Thank you.