2 Samuel 12:20

Then David arose from the earth, and washed, and anointed himself, and changed his apparel, and came into the house of the LORD, and worshipped: then he came to his own house; and when he required, they set bread before him, and he did eat.

This verse belongs to the history of David's adultery and murder of Uriah recorded in 2 Samuel 11 and 12. In that history Joab carried out David's order to kill Uriah the Hittite and sent a carefully worded report that would not implicate Joab or the king, announcing that Uriah was dead also, and David answered that the sword devours one as well as another and told Joab to make the battle stronger against the city and overthrow it. At that time David had departed from God and yielded himself to the wicked one and became for the time the agent of Satan, yet he still held the position and authority God had given him. That power had been given to be exercised only in harmony with divine law, but he commanded what was contrary to God's law and claimed an obedience that would imperil the soul of the one who yielded it, and Joab, whose allegiance was to the king rather than to God, transgressed God's law because the king commanded it. When human authority commands contrary to God's law, it becomes sin to obey.

The setting shows that David's place as king did not make him secure when he forsook God's instruction, and turning from God's doctrines sullied his reputation. He was firm while God's Word guided him and fell when he turned from it. While the child lived, David fasted and humbled himself deeply to plead for its life, putting off his royal robes and laying aside his crown and lying night after night upon the earth in heart-broken grief to intercede for the innocent one suffering for his guilt, refusing to be raised by the elders of his house. He persevered in pleading because judgments pronounced upon persons or cities had often been turned aside by humiliation and repentance, and he hoped the merciful God swift to pardon would send peace and spare the child.

When the child died David ended his pleading and quietly accepted the death as God's decree, the first stroke of the retribution he himself had declared just, and trusting in God's mercy he was not without comfort. He rose from the ground, came into the house of the Lord and worshiped, returning to worship after the child's death, then came to his own house and took food again and resumed eating. His stopping of mourning when he learned the child had died is an example of not continuing to grieve over the dead.