How would you even know what a day was, if God hadn’t created the Sun until Day 4?
You would know because the creation account was written, by Moses, inspired by God. God would obviously Know.
No animals were created untill the length of days was set.