2 Samuel 12:16-24 AMP
David therefore appealed to God for the child [to be healed]; and David fasted and went in and lay all night on the ground. The elders of his household stood by him [in the night] to lift him up from the ground, but he was unwilling [to get up] and would not eat food with them. Then it happened on the seventh day that the child died. David’s servants 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 would not listen to our voices. How then can we tell him the child is dead, since he might harm himself [or us]?” But when David saw that his servants were whispering to one another, he realized that the child was dead. So David said to them, “Is the child dead?” And they said, “He is dead.” Then David got up from the ground, washed, anointed himself [with olive oil], changed his clothes, and went into the house of the LORD and worshiped. Then he came [back] to his own house, and when he asked, they set food before him and he ate.
Then his servants said to him, “What is this thing that you have done? While the child was alive you fasted and wept, but when the child died, you got up and ate food.” David said, “While the child was still alive, I fasted and wept; for I thought, ‘Who knows, the LORD may be gracious to me and the child may live.’ But now he is dead; why should I [continue to] fast? Can I bring him back again? I will go to him [when I die], but he will not return to me.”
David comforted his wife Bathsheba, and went to her and lay with her; and she gave birth to a son, and David named him Solomon. And the LORD loved the child