Answer
Trying to determine when God created the angels is somewhat tricky because anything God did “before the foundation of the world” puts the event outside of time itself. Time and space are characteristics of our world, not God’s. He is not limited by hours, days, and years as we are. In fact, the Bible tells us that “with the Lord a day is like a thousand years, and a thousand years are like a day” «But, beloved, be not ignorant of this one thing, that one day is with the Lord as a thousand years, and a thousand years as one day. », (2 Peter 3:8).
We do know that God created the angels before He created the physical universe. The book of Job describes the angels worshiping God as He was creating the world: “Where were you when I laid the earth’s foundation? Tell me, if you understand. Who marked off its dimensions? Surely you know! Who stretched a measuring line across it? On what were its footings set, or who laid its cornerstone – while the morning stars sang together and all the angels shouted for joy?” (Job 38:4-7).
If we consider the function of angels, we might conclude that God created the angels just prior to the creation of mankind because one of their duties is to be “ministering spirits sent to serve those who will inherit salvation” «Are they not all ministering spirits, sent forth to minister for them who shall be heirs of salvation?», (Hebrews 1:14). We also know they existed prior to the garden of Eden, because Satan, who was formerly there.
The angel Lucifer was already present in the garden in his fallen state. However, because another function of angels is to worship God around His throne (Revelation 5:11-14), they may have been in existence for millions of years—as we understand time—before God created the world, worshiping Him and serving Him.
So, although the Bible does not specifically mention when God created the angels, it was sometime before the world was created. Whether this was a day before, or billions of years before—as we understand time—we cannot be certain.