If someone does not know or forgets that it is the month of Ramadan and becomes aware of this before ẓuhr, in the event that he has done something that invalidates a fast, his fast is invalid (bāṭil) and [he must act according to two instructions]: (1) for the rest of that day, he must not do anything else that invalidates a fast until maghrib; and (2) after the month of Ramadan, he must keep a qaḍāʾ fast for it.
If someone becomes aware after ẓuhr that it is the month of Ramadan and he has not done anything that invalidates a fast, then based on obligatory precaution, he must fast with the intention of rajāʾ [i.e. to keep the fast in the hope that it is desired by Allah]; and after the month of Ramadan, he must also keep a qaḍāʾ fast for it. However, if he becomes aware before ẓuhr and has not done anything that invalidates a fast, he must make the intention of fasting and his fast will be valid.