Since the Bible affirms that Jesus is God, it is often perplexing to note that Jesus addresses God in prayer. The answer to this, as well as to all references to Jesus as being tired or hungry, weeping, lacking knowledge, etc., is that Jesus was a true man, as well as God.
The second Person of the Trinity, God the Son, took upon Himself complete humanity, except for our sinful nature, when He was conceived in Mary. He is described by theologians as one Divine Person having two natures, divine and human—the God-man.
Passages of Scripture which describe Jesus' limitations are referring to His humanity. He lived His life as a true man, depending upon His heavenly Father day by day, just as we are expected to do. Many believe that even His miracles and supernatural knowledge were enabled by the Holy Spirit, not accomplished by switching back and forth between His divine and human natures.
When Jesus cried from the cross, "My God, my God, why have you forsaken me?" He was expressing from His human consciousness the terrible sense of being separated from His heavenly Father as He suffered the penalty for the world's sin. He, of course, with respect to His divine nature, could not suffer or die. In all of this great mystery, we have only glimmers of truth which is beyond human comprehension.