As written in Psalm 30, David’s experience was a sense of security when the Lord was with him but he was distressed when the Lord was not with him. The source of this feeling of security mentioned in verse 6 is the presence of the Lord. David’s confidence was shaken when he didn’t pray for help and praise the Lord for that help.
The difference maker from David’s despair to his joy was his relationship with the Lord. When he prayed for help, he was released from his sense of gloom and received joy in return. So much joy that He praised the Lord.
I’m reminded of some photos I took one time at the office. Looking out the window, I took a photo of a cold wintry day with snow on the ground. The weather in Texas can change fast and before long, the snow melted. As these photos below demonstrate, the morning can be cold with snow and the afternoon can be sunny and clear.

Morning

Afternoon
So it is with our confidence or sense of security. We can change from being downcast to great joy by simply beginning our day with prayer and offering praises to our Lord.
This day with You Lord, we have learned from David’s experience how bad times can turn into good times with Your help. Like turning on a light switch, we can turn darkness into light. Today Lord, we will trust and obey and follow your way. Like a spark in the night, Your presence now has sparked a new light on our day and we have confidence that the impossible can become possible because You are with us. Amen.