"From days to days" (Exodus 13:10). Why is this said? Because Scripture says, "And it shall be for a sign" (Exodus 13:9), I might understand that the nights too are included. And there is reason to argue so: since the mezuzah is a positive commandment and tefillin is a positive commandment, if you have learned about the mezuzah that it applies at night as by day, perhaps tefillin too applies at night as by day. Therefore Scripture teaches, "From days to days": by day you put them on, and you do not put them on at night. Another interpretation: "From days to days," why is this said? Because Scripture says, "And it shall be for a sign," I might understand that Sabbaths and festivals too are included. And there is reason to argue so, as above with the mezuzah; therefore Scripture teaches, "From days to days," excluding Sabbaths and festivals. Rabbi Yoshiyah says: "from days"—there are days when you put them on and days when you do not put them on; this excludes Sabbaths and festivals. Rabbi Yitzchak says: since the Sabbath is called a sign and tefillin are called a sign, one does not place a sign within a sign. Or should one place a sign within a sign? You say: the Sabbath, which is called a sign and a covenant, shall not be set aside for tefillin, which are called only a sign and not a covenant. Rabbi Azaryah says: since the Sabbath is called a sign and tefillin are called a sign, one does not place a sign within a sign. Or should one place a sign within a sign? You say: the Sabbath, for which one is liable to karet [excision] and death by the court, shall not be set aside for tefillin, for which one is liable neither to karet nor to death by the court.
Why Tefillin Are Not Worn at Night or on the Sabbath
Yalkut Shimoni on Torah 222:5
מִיָּמִים יָמִימָה. לָמָּה נֶאֱמַר, לְפִי שֶׁהוּא אוֹמֵר וְהָיָה לְךָ לְאוֹת שׁוֹמֵעַ אֲנִי אַף הַלֵּילוֹת בְּמַשְׁמָע, וְהַדִּין נוֹתֵן, הוֹאִיל וּמְזוּזָה מִצְוַת עֲשֵׂה וּתְפִלִּין מִצְוַת עֲשֵׂה, אִם לָמַדְתָּ עַל מְזוּזָה שֶׁהִיא נוֹהֶגֶת בַּלֵּילוֹת כְּבַיָּמִים אַף תְּפִלִּין יִנְהֲגוּ בַּלֵּילוֹת כְּבַיָּמִים, תַּלְמוּד לוֹמַר מִיָּמִים יָמִימָה. בַּיָּמִים אַתָּה נוֹתֵן וְאִי אַתָּה נוֹתֵן בַּלַּיְלָה. דָּבָר אַחֵר, מִיָּמִים יָמִימָה, לָמָּה נֶאֱמַר, לְפִי שֶׁהוּא אוֹמֵר וְהָיָה לְךָ לְאוֹת שׁוֹמֵעַ אֲנִי אַף שַׁבָּתוֹת וְיָמִים טוֹבִים בְּמַשְׁמָע, וְהַדִּין נוֹתֵן, הוֹאִיל וּמְזוּזָה מִצְוַת עֲשֵׂה וּתְפִלִּין מִצְוַת עֲשֵׂה, אִם לָמַדְתָּ עַל מְזוּזָה שֶׁהִיא נוֹהֶגֶת בְּשַׁבָּתוֹת וְיָמִים טוֹבִים יָכוֹל אַף תְּפִלִּין יִנְהֲגוּ בְּשַׁבָּתוֹת וְיָמִים טוֹבִים, תַּלְמוּד לוֹמַר מִיָּמִים יָמִימָה, יָצְאוּ שַׁבָּתוֹת וְיָמִים טוֹבִים. רַבִּי יֹאשִׁיָּה אוֹמֵר, מִיָּמִים, יֵשׁ יָמִים שֶׁאַתָּה נוֹתֵן וְיֵשׁ יָמִים שֶׁאֵין אַתָּה נוֹתֵן, יָצְאוּ שַׁבָּתוֹת וְיָמִים טוֹבִים. רַבִּי יִצְחָק אוֹמֵר, הוֹאִיל וְשַׁבָּת קְרוּיָה אוֹת וּתְפִלִּין קְרוּיִן אוֹת לֹא יִתֵּן אוֹת בְּתוֹךְ אוֹת. אוֹ יִתֵּן אוֹת בְּתוֹךְ אוֹת, אָמַרְתָּ, לֹא תִדָּחֶה שַׁבָּת שֶׁהִיא קְרוּיָה אוֹת וּבְרִית, לִתְפִלִּין שֶׁאֵין קְרוּיִן אוֹת וּבְרִית אֶלָּא אוֹת בִּלְבַד. רַבִּי עֲזַרְיָה אוֹמֵר, הוֹאִיל וְשַׁבָּת קְרוּיָה אוֹת וּתְפִלִּין קְרוּיִן אוֹת לֹא יִתֵּן אוֹת בְּתוֹךְ אוֹת. אוֹ יִתֵּן אוֹת בְּתוֹךְ אוֹת. אָמַרְתָּ, לֹא תִדָּחֶה שַׁבָּת שֶׁחַיָּיבִין עָלֶיהָ כָּרֵת וּמִיתַת בֵּית דִּין לִתְפִלִּין שֶׁאֵין חַיָּבִין עָלֵיהֶן לֹא כָּרֵת וְלֹא מִיתַת בֵּית דִּין.