And when the mourning was past, David sent and fetched her to his house, and she became his wife, and bare him a son. But the thing that David had done displeased the LORD. (2 Samuel 11:27 KJV)
And David said unto Nathan, I have sinned against the LORD. And Nathan said unto David, The LORD also hath put away thy sin; thou shalt not die. (2 Samuel 12:13 KJV)
God hates sin!
David has come up with a scheme to rid Uriah off the face of the earth after he had committed adultery with Bathsheba his wife and got her pregnant. He thought the coverup was the best plan and then both himself and Bathsheba could move on with their lives.
This wasn't so though. God commissions Nathan to approach David and tell him that he was displeased with his actions and he was going to punish him for his deeds. David recognises his mistake and confesses - I have sinned against the LORD. (2 Samuel 12:13 KJV)
After the confession, God reduces his punishment and makes him aware that he would not die. God is A God of a Second Chance. David had to bear the punishment of losing that first son by Bathsheba. No matter how he prayed and fasted, God had to allow him to hurt so that he can understand.
There is a lesson for all of us to learn. When we sin, God hates that and he will punish us because he loves us and wants the best for us. At times, the punishment is harsh and severe, but we must learn to endure and trust him for he just wants to bring out the BEST in us.
After this mistake, David drew closer to God and was a better person. Don't mind when earthly folks write you off from mistakes you've made. Once you tell God you'e sorry and mean it from the bottom of your heart, he will HEAR - FORGIVE - HELP. After doing that, you'll be a much better person indeed.
Lord - Thank You For Being a God of A Second Chance. Friend, why not say your sorry for your sins now. God's waiting!