Well, I am not going to pretend I understand God, I think we are overstepping our bounds when we attempt this.
But some information is given us in the scriptures. First, God told Moses that his name is I AM.
Exo 3:14 And God said unto Moses, I AM THAT I AM: and he said, Thus shalt thou say unto the children of Israel, I AM hath sent me unto you.
God simply exists. He has always existed, and always will. This is mind-boggling to say the least. I have often wondered why God waited so long to create the world and us now. If we were to go back a hundred trillion years in time, God existed hundreds of trillions of years before that. We cannot grasp infinity.
And how can we grasp God's knowledge? Knowledge is infinite, and yet God knows all things. And the scriptures say that God has foreknowledge, so he knows all things that are to come to pass.
Jesus also said he is the Alpha and Omega, which means the beginning and end. So, here God seems to place himself within time.
Rev 1:8 I am Alpha and Omega, the beginning and the ending, saith the Lord, which is, and which was, and which is to come, the Almighty.
God really has no beginning or end, he has existed forever and always will. But God seems to place himself within time.
That's about all I can say on the subject. I do not keep myself awake at night worrying about things like this. God is too great for us to understand.