It is difficult to tell when God formed the angels since everything God accomplished “before the foundation of the world” occurs outside of time. God’s universe lacks the qualities of time and space. He is not bound by time in the same way that we are. In reality, the Bible states, “a day is like a thousand years with the Lord, and a thousand years are like a day” (2 Peter 3:8). We are aware that God created the angels prior to the physical cosmos. The book of Job recounts angels worshipping God as He created the universe “Where were you when I lay the foundation of the earth? Tell me, if you understand. Who determined its dimensions? Surely, you are aware! Who measured it with a measuring tape? How were its foundations constructed, and who lay its cornerstone, while the morning stars sang in harmony and all the angels cried out in joy?” (Job 38:4-7). If we analyze the purpose of angels, we may assume that God created them prior to the creation of people, because one of their jobs is to assist those who will receive salvation (Hebrews 1:14). Satan, who was originally the angel Lucifer, was already present in the Garden of Eden in his fallen condition; therefore, we also know they existed before the Garden of Eden. Because another role of angels is to worship God at His throne (Revelation 5:11-14), they may have existed many years before God created the earth, praising and serving Him. Because God and the angels live in a dimension without time, we cannot determine how long the angels existed before God created the universe from a timeless dimension. Therefore, while the Bible does not specify when God formed the angels, it occurred prior to the creation of the earth. Again, based on how we measure time, we cannot be certain whether something occurred a day or billions of years ago.
Primary source: Got questions “When did God create the angels?”