Life is undoubtedly full of ups and downs. However, as Muslims, we must remember Allah (سُبْحَانَهُ وَتَعَالَى) in all phases of life, whether good or bad. The Prophet Muhammad (ﷺ) taught us, by his Sunnah, what to do and say in times of happiness and sorrow. To ensure that you do not become ungrateful and that you learn to accept Allah's will with grace, you should recite the dua proven by Sunnah. If you've just received news you were glad to hear or news that has been anxiety-inducing and displeasing, you should recite the dua given below:
Joy & Distress Duas
Alhamdu lillaahil-lathee bini'matihi tatimmus-saalihaat.(1)Alhamdu lillaahi 'alaa kulli haal.(2)
When something happened that pleased him say: "Praise is to Allah Who by His blessings all good things are perfected".(1)And if something happened that displeased him say: "Praise is to Allah in all circumstances".(2)
The Prophet (ï·º) would recite "Alhamdu lillaahil-lathee bini'matihi tatimmus-saalihaat" when something happened that would please him. However, if something happened that displeased him, he would recite "Alhamdu lillaahi 'alaa kulli haal."
Therefore, there is no specific etiquette to follow when reciting the dua. You can recite it immediately according to the situation. The essence of the dua is to be thankful to Allah when you receive news or a happening that has made you pleased or happy. As a Muslim, you must thank Allah for every blessing that appeals to him. However, if you've received news you are not happy with or are devasted with, you should still thank Allah, as there is a reason behind each of Allah's decisions for you. So, thank him, pray for betterment, and leave it up to Him to protect you and make the situation better for you.
Allah says in the Quran: And ˹remember˺ when your Lord proclaimed, 'If you are grateful, I will certainly give you more. But if you are ungrateful, surely My punishment is severe.'" – 14:7