Fasting & Intention (Hadith No. 1642)

Bismillah.
Is it necessary to make an intention before fasting? If yes, when to make that intention?
Volume 3, Book 31, Number 147:
Narrated Salama bin Al-Akwa (radiallaahu `anhu):
Once the Prophet (sallallaahu `alayhi wasallam) ordered a person on 'Ashura' (the tenth of Muharram) to announce, "Whoever has eaten, should not eat any more, but fast, and who has not eaten should not eat, but complete his fast (till the end of the day).

The Ruling

It was narrated by Ibn ‘Umar from Hafsah (may Allaah be pleased with her) that the Prophet (peace and blessings of Allaah be upon him) said:
Whoever does not have the intention of fasting before Fajr, there is no fast for him.
Narrated by Imam Ahmad, the authors of al-Sunan, Ibn Khuzaymah and Ibn Hibbaan; they classed it as saheeh and marfoo’.

Obligatory or Voluntary?

Summary: For obligatory fasts, intention has to be made before Fajr that day. But for voluntary fasts, intention can be made later on during the day if one hasn't eaten/drunk/had intercourse after Fajr that day. Read below for details.
It is essential to make the intention to fast the month of Ramadan at night, before Fajr. It is not sufficient to start fasting it that day without the intention. Whoever finds out at the time of Duha that today it is Ramadan and makes the intention of fasting has to refrain from eating until sunset, and he also has to make up that day. This is with regard to obligatory fasts. With regard to naafil (voluntary) fasts it is permissible to make the intention to fast on the day, if you have not eaten or drunk or had intercourse after Fajr, because it was proven in the hadeeth of ‘Aa’ishah (may Allaah be pleased with her) that the Prophet (peace and blessings of Allaah be upon him) entered upon her one day at duha time and said, “Do you have anything (any food)?” She said, “No.” He said, “Then I am fasting.” Narrated by Muslim in his Saheeh