The Shulchan Aruch · Orach Chayim
אורח חיים תקס״גOrach Chayim 563
Siman 563 of 697 in Orach Chayim — 1 se'if
הלכות תעניתLaws of Fast Days· siman 563
Se’if 1א׳
מִי שֶׁהִרְהֵר בְּלִבּוֹ, שֶׁלֹּא בִּשְׁעַת תְּפִלַּת הַמִּנְחָה, לְהִתְעַנּוֹת לְמָחָר, לֹא הָוֵי קַבָּלָה דְּלֹא עָדִיף מֵהוֹצִיא בְּפִיו לְהִתְעַנּוֹת לְמָחָר דְּלֹא הָוֵי קַבָּלַת תַּעֲנִית, כֵּיוָן שֶׁלֹּא קִבְּלוֹ בִּתְפִלַּת הַמִּנְחָה.
If one mentally expresses a plan to fast the following day not during the afternoon prayer, this does not constitute acceptance [of a fast], is it is not better than the verbal expression of a plan to fast the following day, which is not an acceptance of a fast because it is not during the afternoon prayer.
Shulchan Aruch, Orach Chayim — Torat Emet 363 edition, via Sefaria — public domain
English: Sefaria Community Translation — CC0