New King James Version (NKJV)
Genesis 39
20 Then Joseph’s master took him and put him into the prison, a place where the king’s prisoners were confined. And he was there in the prison.
21 But the Lord was with Joseph and showed him mercy, and He gave him favor in the sight of the keeper of the prison.
22 And the keeper of the prison committed to Joseph’s hand all the prisoners who were in the prison; whatever they did there, it was his doing.
23 The keeper of the prison did not look into anything that was under Joseph’s authority, because the Lord was with him; and whatever he did, the Lord made it prosper.
Genesis 40
1 It came to pass after these things that the butler and the baker of the king of Egypt offended their lord, the king of Egypt.
2 And Pharaoh was angry with his two officers, the chief butler and the chief baker.
3 So he put them in custody in the house of the captain of the guard, in the prison, the place where Joseph was confined.
4 And the captain of the guard charged Joseph with them, and he served them; so they were in custody for a while.
5 Then the butler and the baker of the king of Egypt, who were confined in the prison, had a dream, both of them, each man’s dream in one night and each man’s dream with its own interpretation.
6 And Joseph came in to them in the morning and looked at them, and saw that they were sad.
7 So he asked Pharaoh’s officers who were with him in the custody of his lord’s house, saying, "Why do you look so sad today?"