ANSWER: Jesus Christ had supreme faith, being born with the Holy Spirit without measure, so we should not think He had doubts regarding His identity as God in the flesh. Notice Peter's confidence in identifying His true nature when he said to him the following.
|16. Then Simon Peter answered and said, "You are the Christ, the Son of the living God." 17. And Jesus answered and said to him, "Blessed are you, Simon Bar-Jona, for flesh and blood did not reveal it to you, but My Father, Who is in heaven. (Matthew 16:13 - 17, HBFV throughout)|
Although various ideas existed as to who Jesus was, he himself knew His true identity. The Father in heaven blessed Peter by revealing to him his Son's spiritual identity and allowed him to proclaim it to the other disciples.
One never sees any self-doubt our Savior may have had about His identity. His hesitation in the Garden of Gethsemane (Matthew 26:37 - 39), which concerned His temptation to want the cup of His sacrifice to pass by, was not about His identity or a kind of self-doubt. Since he was also a prophet, He had direct knowledge from the Father that humans never had. Therefore, given that knowledge, He did not need faith to know about him the way we do, since we never have had the kind of direct contact with the Father as He did before his incarnation (That is, before being put into the Virgin Mary's womb).
He certainly had NO DOUBT regarding his identity as the Messiah when he testified before the Sanhedrin (Mark 14:60 - 62, see Daniel 7:13 for the Old Testament text he was alluding to). It was his statement regarding who is was that gave the Jewish religious leaders the excuse they needed to condemn him to death.
There is one interesting speculation regarding when Christ knew he was God that cannot be definitely proven. It concerns when he was first self-enlightened to know He was Deity.
After all, as Jesus grew up, it does not seem plausible He always knew that He was Deity, such as when He was three years old (see Luke 2:52). It could be when He was twelve years old and got "overlooked" when His family (Mary, Joseph, etc. ) left Jerusalem after the Passover Feast that He became self-aware of His Deity (see John 1:1, 14). They found Him answering questions in the temple and amazing the teachers there about how learned He was at such a young age. When they questioned him regarding why he had not left Jerusalem with the rest of the family he gave a most revealing answer.
44. But supposing Him (Jesus) to be in the company, they went a day's journey, and looked for Him among the relatives and among the acquaintances. 45. And when they did not find Him, they returned to Jerusalem, seeking Him. 46. Now it came to pass that after three days they found Him in the temple, sitting in the midst of the teachers, both hearing them and questioning them . . .
48. But when they saw Him, they were astonished; and His mother said to Him, "Son, why have you dealt with us in this manner? Look, Your father and I have been very distressed while searching for You." 49. And He said to them, "Why is it that you were looking for Me? Don't you realize that I must be about My Father's business?" (Luke 2:44 - 46, 48 - 49)
This MAY have been the first time Jesus knew he was God and understood his mission revealed directly from his Father in heaven. It is possible from this time forward He knew He would eventually be crucified, which is a most gruesome thought indeed.