2 Samuel 12:11-21

11 Thus says the Lord: I will raise up trouble against you from within your own house; and I will take your wives before your eyes, and give them to your neighbor, and he shall lie with your wives in the sight of this very sun.
12 For you did it secretly; but I will do this thing before all Israel, and before the sun."
13 David said to Nathan, "I have sinned against the Lord." Nathan said to David, "Now the Lord has put away your sin; you shall not die.
14 Nevertheless, because by this deed you have utterly scorned the Lord, the child that is born to you shall die."
15 Then Nathan went to his house. The Lord struck the child that Uriah's wife bore to David, and it became very ill.
16 David therefore pleaded with God for the child; David fasted, and went in and lay all night on the ground.
17 The elders of his house stood beside him, urging him to rise from the ground; but he would not, nor did he eat food with them.
18 On the seventh day the child died. And the servants of David were afraid to tell him that the child was dead; for they said, "While the child was still alive, we spoke to him, and he did not listen to us; how then can we tell him the child is dead? He may do himself some harm."
19 But when David saw that his servants were whispering together, he perceived that the child was dead; and David said to his servants, "Is the child dead?" They said, "He is dead."
20 Then David rose from the ground, washed, anointed himself, and changed his clothes. He went into the house of the Lord, and worshiped; he then went to his own house; and when he asked, they set food before him and he ate.
21 Then his servants said to him, "What is this thing that you have done? You fasted and wept for the child while it was alive; but when the child died, you rose and ate food."