All perfect praise be to Allah, The Lord of the Worlds, and may His blessings and peace be upon our Prophet Mohammad and upon all his family and companions.
Niyah is to intend doing something with determination, and it comes from one`s heart. It isn`t a condition that one utters it when undertaking acts of worship. Muslim scholars are of the view that uttering Niyah in acts of worship is a Sunnah in order for the tongue to confirm what lies in one`s heart.
In prayer, intention or Niyah is formed by remembering it before praying and it is a condition that the praying person specifies the prayer that he is about to perform, Asr or Dhur.
"He makes the intention at heart. If it is an obligatory prayer, it is imperative that he intends performing it and specifies which prayer e.g. Asir, Friday or Dhur prayer. It is imperative that he associates the intention to perform the prayer with "Takbeer", so his remembering the intention is obligatory; whereas, uttering it is preferable. In supererogatory prayer that has a specific time such as Eid prayer, eclipse prayer, Dhur Sunnah… etc., even if it was absolutely supererogatory, the intention to perform it avails him"{Umdat Assalik, Ibn An-Nakeeb, p.66}.
As far as fasting is concerned, one must make the intention to fast and avoid things that invalidate it, as prescribed by Allah, The Almighty. Once the idea of observing fast for the following day crosses one`s mind, because Allah has commanded that, then it is considered a valid intention.
Moreover, waking up to have the predawn meal (Sahoor), along with the idea of fasting tomorrow coming to one`s mind, avails for the intention to fast.
However, the ruling on Niyah or intention varies in line with the type of fast. In obligatory fasting, like fasting Ramadan, making up for obligatory fast or vow fast, one has to have the intention to fast from the night before, and delaying the intention doesn`t avail him because it is imperative that he fasts every moment from dawn time until sunset.
"It is a condition in obligatory fasting, like fasting Ramadan, making up for obligatory fast or vow fast, to have the intention to fast from the night before, as indicated by what the Prophet (PBUH) said in the following tradition: "Whoever does not form his intention to fast before to fajr, his fasting will not be accepted." {Narrated by Dar Qotni and others}" {Nihayat al-Mohtajj}.
In voluntary fasting, like fasting the Day of Arafah, it is sufficient for one to form the intention to fast after the break of dawn, but before Dhur time, provided that he hasn`t eaten or drunk before forming that intention, as indicated in the following tradition: 'A'isha, the Mother of the Believers (Allah be pleased with her), reported : "The Apostle of Allah (PBUH) came to me one day and said: Is there anything with you (to eat)? I said: No. Thereupon he said: I shall then be fasting." {Muslim}. And Allah knows best.