Shulchan Aruch, Orach Chayim Siman 30

Siman 30

Presented here for study, not as a practical ruling. The Shulchan Aruch rules by Sephardi custom, the Rema's glosses by Ashkenazi custom, and the Kitzur follows Ashkenazi custom. For a practical question, ask your rabbi.

א זְמַן הֲנָחָתָן בַּבֹּקֶר, מִשֶּׁיִּרְאֶה אֶת חֲבֵרוֹ הָרָגִיל עִמּוֹ קְצָת בְּרִחוּק אַרְבַּע אַמּוֹת וְיַכִּירֶנּוּ.
1 The time to put them [Tefillin] in the morning is at the time when one can see his close friend from four cubits away and recognize him.
ב אָסוּר לְהָנִיחַ תְּפִלִּין בַּלַּיְלָה, שֶׁמָּא יִשְׁכְּחֵם וְיִישַׁן בָּהֶם. אִם הֵנִיחָם קֹדֶם שֶׁתִּשְׁקַע הַחַמָּה וְחָשְׁכָה עָלָיו, אֲפִלּוּ הֵם עָלָיו כָּל הַלַּיְלָה, מֻתָּר, וְאֵין מוֹרִין כֵּן. אִם לֹא חָלַץ תְּפִלִּין מִשֶּׁשָּׁקְעָה חַמָּה מִפְּנֵי שֶׁלֹּא הָיָה מָקוֹם לְשָׁמְרָן, וְנִמְצְאוּ עָלָיו כְּדֵי לְשָׁמְרָן, מֻתָּר, וּמוֹרִין כֵּן.
2 One is prohibited to put Tefillin on at night since he may forget [that he has them on] and sleep in them. If he puts them on before the sun sets and it happens to get dark, even if he wears them the whole night, it is permitted. [However] we do not teach [people] to do this. If he did not remove the Tefillin once the sun set since he had no place to guard them and therefore, left them on to protect them... This is allowed and is such taught.
ג הָיָה רוֹצֶה לָצֵאת לַדֶּרֶךְ בַּהַשְׁכָּמָה מְנִיחָם, וּכְשֶׁיַּגִּיעַ זְמַנָּם יְמַשְׁמֵשׁ בָּהֶם וִיבָרֵךְ, דְּלֵיכָּא לְמֵיחַשׁ שֶׁמָּא יִישַׁן בָּהֶם, כֵּיוָן שֶׁהִשְׁכִּים וְיָצָא לַדֶּרֶךְ.
3 If one wanted to go out on his way early [in the morning, before the actual time that is permitted to put them on], he puts them on, and when their time comes,he should feel them and make the bracha on them. There is no need to be concerned that he may sleep in them since he is getting up to go on his way.
ד הָיָה בָּא בַּדֶּרֶךְ וּתְפִלִּין בְּרֹאשׁוֹ וְשָׁקְעָה עָלָיו חַמָּה, אוֹ שֶׁהָיָה יוֹשֵׁב בְּבֵית הַמִּדְרָשׁ וּתְפִלִּין בְּרֹאשׁוֹ, וְקָדַשׁ עָלָיו הַיּוֹם יַנִּיחַ יָדוֹ עֲלֵיהֶם עַד שֶׁיַּגִּיעַ לַבַּיִת, וְאִם יֵשׁ בַּיִת קָרוֹב לַחוֹמָה שֶׁמִּשְׁתַּמְּרִין שָׁם, חוֹלְצָן וּמַנִיחָם שָׁם.
4 ... If one was travelling with his tefillin on and the sun set or if he was in the Bais Midrash and Shabbos arrived he should cover his tefillin with his hand until he reaches his house and if there is a house close to the entrance of the city that is safe he should leave his tefillin there.
ה יֵשׁ מִי שֶׁאוֹמֵר שֶׁאִם הִתְפַּלֵּל תְּפִלַּת עַרְבִית מִבְּעוֹד יוֹם, עַד שֶׁלֹּא הֵנִיחַ תְּפִלִּין אֵין לוֹ לַהֲנִיחָם אַחַר כָּךְ:
5 ... There is an opinion that maintains that if one davened maariv while yet day and has not yet put on tefillin he may no longer put them on that day.