Please contribute generously in order to ensure the continuity of our website InshaAllah.
Praise be to Allah.
Forming the intention from the night before is a condition of an obligatory fast being valid, because of the hadeeth of Hafsah, the wife of the Prophet (blessings and peace of Allah be upon him), according to which the Messenger of Allah (blessings and peace of Allah be upon him) said: “Whoever did not intend to fast before Fajr, there is no fast for him.” Narrated by Abu Dawood (2454); classed as saheeh by al-Albaani in Irwa’ al-Ghaleel (4/25, no. 914).
An-Nawawi (may Allah have mercy on him) said:
Our view – i.e., the Shaafa‘is – is that the fast of Ramadan is not valid without having the intention from the night before. This is the view of Maalik, Ahmad, Ishaaq, Dawood and many of the scholars among the earlier and later generations.
End quote from al-Majmoo‘ (6/318)
But the issue of the intention is very easy; simply resolving and planning to fast after finding out that the next day is Ramadan is the intention, and it is not necessary to utter it out loud; rather that is not prescribed.
Ibn Taymiyah (may Allah have mercy on him) said:
Anyone who finds out that the next day is Ramadan and wants to fast it has intended to fast it, whether he spoke the intention out loud or not. This is the practice of the majority of Muslims; all of them intend to fast.
End quote from Majmoo‘ al-Fataawa (25/215).
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) said in ash-Sharh al-Mumti‘ (6/353-354):
The intention cannot be omitted from a conscious action. In other words, any deed that a person does consciously must inevitably be done with the intention. Thus we know that what happens to some people of waswaas, when a person says “I did not form the intention” is no more than an illusion which has no basis in reality. How can it be true that he did not form the intention when he has done it? End quote.
The intention to fast the whole of the month of Ramadan, from the first day, suffices as the intention so long as the fast is not interrupted by travel or sickness, in which case he should renew his intention, but that is not essential. It is not stipulated that the Muslim must form the intention to fast the whole of the month of Ramadan from the beginning of the month. If he intends to do that on every night of the month and then fasts, his fast is valid.
Ibn al-Qattaan (may Allah have mercy on him) said:
The scholars are unanimously agreed that if a person intends to fast on every night of the month of Ramadan, and he fasts, then his fast is complete.
End quote from al-Iqnaa‘ fi Masaa’il al-Ijmaa‘ (1/227)
But if what the questioner means is that he did not renew his intention to fast at all until the first day of Ramadan began, and he was unaware as to whether this day was Ramadan or not, then after dawn broke he remembered that it was Ramadan, and he had not intended at any point in the night that the next day he would fast the first day of Ramadan, and he did not get up to have sahoor on that day, then he has to refrain from eating from the moment he finds out that it is Ramadan, and he has to make up that day, because it is obligatory to form the intention from the night before, as mentioned above.
For more information on how to form the intention to fast, see the answer to question no. 22909.
And Allah knows best.