סימן ס סעיף ז
לְכַתְּחִלָּה יֵשׁ לְבָרֵךְ בַּבֹּקֶר מִיָּד בְּהַנֵּץ הַחַמָּה מִשּׁוּם דִּזְרִיזִין מַקְדִּימִין לְמִצְוֹת. וְטוֹב אִם אֶפְשָׁר לְבָרֵךְ בַּאֲסֵפַת עָם, מִשּׁוּם דִּבְרָב עָם הַדְרַת מֶלֶךְ. (וְיֵשׁ לְהַכְרִיז בַּיּוֹם שֶׁלְּפָנָיו לְמַעַן יֵדְעוּ לְהִתְאַסֵּף). אִם אִי אֶפְשָׁר לְהִתְאַסֵּף תֵּכֶף בַּבֹּקֶר אַל יִתְאַחֲרוּ בִּשְׁבִיל זֶה, אֶלָּא כָּל אֶחָד יְבָרֵךְ מִיָּד כְּשֶׁרוֹאֶה זְרִיחַת הַשֶּׁמֶשׁ, כִּי עִנְיַן זְרִיזִין מַקְדִּימִין דָּחֵי לְעִנְיַן בְּרֹב עַם. וּבְדִיעֲבַד, אִם לֹא בֵּרַךְ בַּבֹּקֶר, יָכוֹל לְבָרֵךְ עַד שָׁלֹשׁ שָׁעוֹת שֶׁל הַיּוֹם, וּבִשְׁעַת הַדְּחַק עַד חֲצוֹת הַיּוֹם. וְלָכֵן אִם בַּבֹּקֶר יֵשׁ עֲנָנִים הַמְכַסִּים אוֹתָהּ, יַמְתִּין עַד קָרוֹב לַחֲצוֹת, אוּלַי תִּתְגַּלֶּה, וִיבָרֵךְ בְּשֵׁם וּמַלְכוּת. וְאִם לֹא נִתְגַלְתָה, יְבָרֵךְ בְּלֹא שֵׁם וּמַלְכוּת. (שְׁנַת קִדּוּשׁ הַחַמָּה הָיְתָה שְׁנַת תרכ"ט. וְתִהְיֶה אִם יִרְצֶה הַשֵּׁם בִּשְׁנַת תרנ"ז, תרפ"ה, תשי"ג, תשמ"א. יְהִי רָצוֹן שֶנִזְכֶּה לְאוֹר שִׁבְעַת יְמֵי בְּרֵאשִׁית) (רכ"ט).
It is best to say this berachah [early] in the morning, immediately after sunrise, because "The diligent perform all mitzvos promptly." It is best, if possible, to say it in an assembly of people for it is written: "In the multitude of people is the king's glory."6Proverbs 14: 28. (An announcement should be made on the day before to inform the public of the gathering). But if it is impossible to call an assembly for early in the morning, the berachah should not be postponed because of that. Rather, each person should say it immediately when he sees the rising sun. The rule that "The diligent do mitzvos promptly" takes precedence [over the rule that] "In the multitude …" If you have not said the berachah in the morning, you may still say it until the third hour of the day and in case of an emergency [you may say it] until noon. Therefore, if [the sky] is cloudy in the morning, and [the sun] is obscured, you should wait until it is near noon, perhaps the sun will by then appear, and you will be able to say the berachah mentioning God's Name and Kingship. But if the sun did not appear by then,7The Chasam Sofer states that when the sun itself is obscured, but its brightness emerges between the clouds, the berachah may be said. But when the sky is completely overcast, the berachah should not be said. (Mishnah Berurah 229: 8) you should say the berachah omitting the Name and Kingship. (The most recent kiddush hachamah occurred in the year 5741/1981. May we merit to live and see the light of the seven days of Creation.)
תנא דבי אליהו כל השונה הלכות בכל יום מובטח לו שהוא בן העולם הבא שנאמר הליכות עולם לו אל תקרי הליכות אלא הלכות (נדה ע"ג.)