When finding out joyous tidings or upon hearing good news from a reliable source, one says a Bracha.
If it only affects oneself, then one says שֶׁהֶחֱיָנוּ; "... who has kept us alive, sustained us and permitted us to reach this occasion."
בָּרוּךְ אַתָּה ה' אֱ-לֹקינוּ מֶלֶךְ הָעוֹלָם
שֶׁהֶחֱיָנוּ וְקִיְּמָנוּ וְהִגִּיעָנוּ לַזְּמַן הַזֶּה
If it affects a group of people, then one says הַטּוֹב וְהַמֵּטִיב; "..Who is Good, and bestows good."
בָּרוּךְ אַתָּה ה' אֱ-לֹקינוּ מֶלֶךְ הָעוֹלָם
הַטּוֹב וְהַמֵּטִיב
If one cannot say the Bracha right away - due to an unclean location or hands - then one can say it later, as long as one still feel the joy.
Even if the joyful event will probably cause one trouble at a later date, one still says the Bracha.
Source: Kitzur Shulchan Aruch 59:1,3
- Danny
Monday, 2 Tammuz 5774
Please daven for 3 year old נָעֳמִי בַּת דִינָה who is being treated for lymphoma