John 13:3 (NIV)
Jesus knew that He had come from God and was returning to God.
When did Jesus know that He was God? Did He know His divinity at birth, or did He gradually grow into that realization? There are only faint clues in the Bible for that. We know that at the tender age of 12, Christ knew that He was God's Son and had to be in His Father's House (Luke 2:49). He knew that He was to be the sacrificial lamb (Luke 12:50) and that His time had come (John 13:1).
However, He might not have known all the details immediately. It's possible that God revealed the details of His plan and purpose for His Son gradually. This is true for us as well. We may not know all God has for us, but we can grow into that knowledge just as Christ did.