I read in Matthew 24:36 that not even the son knows the day that he will return. Only god the father knows. If Jesus is God how can this be? Also when Jesus went off to pray who was he praying to if he is God?
When Jesus came to Earth, He stepped out of the Godhead and voluntarily became a man. One of Satan’s major points in the wilderness temptation (Matthew 4:1-11) was to get Him to act like God again by making bread out of stones, or summoning angels to protect Him.
Had He done so, Jesus would have exceeded the powers given to man and violated His mission. Finally Satan said in effect, “OK. If you’re determined to be just a man, then worship me and I’ll give you the whole Earth.” This would have broken the First Commandment and disqualified Jesus from being our Redeemer, so He refused again and Satan left.
Being just a man while on Earth, Jesus was only able to know the future as God disclosed it to Him, and at that point God had not done so regarding His 2nd Coming. After Jesus went to Heaven, the details were revealed to Him and He gave them to us in the form of the Book of Revelation.
When He prayed, He prayed to God, just like any other man. All His miracles were performed through the power of the Holy Spirit to show us what kind of power we could have, if we developed enough faith. (John 14:12)
Understand that this was all voluntary. He imposed these limits upon Himself because according to God’s law only a man could redeem mankind. At any time He could have chosen to become God again and stopped the whole ordeal. But that would have left us lost in our sins, and He loved us too much to let that happen.