نص الموضوع
Fasting, like any other act of worship, is not valid except with intention.
The time for making the intention for fasting is different in the obligatory fast from the voluntary fast in the following way:
First: In the obligatory fast, like that of Ramadān, making up for the missed fast, or in case of fulfilling a vow, the intention must be made at night before dawn,
The Prophet (may Allah's peace and blessings be upon him) said:
"Whoever does not have the intention of fasting from the night before, his fast is invalid." [50]
[50] Narrated by Ahmad no. (26457), Abu Dāwūd no. (2454), and An-Nasā’i no. (2331) and this is his wording.
Second: In the voluntary fast, it is permissible to make the intention during the day,
provided that one avoids the nullifiers of fasting after the rise of dawn.