There are three specific times recorded in the Gospels that Jesus gave thanks. Perhaps there are more, but these are the ones I have found.
1. The first was when He raised Lazarus from the dead
In Jon 11:41, Jesus prayed and said, “Father, I thank thee that thou hast heard me.” This He said as He was about to raise Lazarus from the dead. He knew that God had heard His prayer. He knew what God was about to do and that He was going to show that Jesus had power over death and Jesus is the Resurrection and the Life.
2. The second time Jesus gave thanks was when He upbraided the cities where He had done mighty works and the people did not believe on Him. He was thankful that there would be some who did believe on Him and the Father would reveal to them His word and way.
In Matthew 11:25, the Bible says, “At that time Jesus answered and said, I thank thee, O Father, Lord of heaven and earth, because thou hast hid these things from the wise and prudent, and hast revealed them unto babes.” God would reveal the hidden treasures of His knowledge to those who followed Jesus. These things were not for those who were wise and prudent among men but for those who were humble before God. Jesus was thankful for the way His Father revealed things to those who had a heart to receive.
3. The third time Jesus gave thanks was at the last supper
Jesus gave thanks twice at the last supper. First He gave thanks for the bread which represented His body that He would give for His disciples and for all who would believe on Him after His disciples. Jesus knew that His gift, His sacrifice, would be enough and that it would not be in vain; and Jesus was thankful. Luke 22:19,20 says, “19And he took bread, and gave thanks, and brake it, and gave unto them, saying, This is my body which is given for you: this do in remembrance of me. 20Likewise also the cup after supper, saying, This cup is the new testament in my blood, which is shed for you.”
Jesus gave thanks for the cup because it represented His blood which He shed for the remission of sins. “27And he took the cup, and gave thanks, and gave it to them, saying, Drink ye all of it; 28For this is my blood of the new testament, which is shed for many for the remission of sins.” (Matthew 26:27,28)
Jesus came to do the will of His Father, and He was very thankful that the Father’s will had been done through Him.