Moon-sighting: The Basic Principle (Hadith No. 1619)
Narrated Ibn Umar (radiallaahu `anhu):
I heard Allah’s Apostle (sallallaahu `alayhi wasallam) saying, “When you see the crescent (of the month of Ramadan), start fasting, and when you see the crescent (of the month of Shawwal), stop fasting; and if the sky is overcast (and you can’t see It) then regard the crescent (month) of Ramadan (as of 30 days)”.
What counts with regard to confirming the beginning of the month of Ramadan is sighting of the new moon or the completion of 30 days of Sha’baan if the moon is not sighted.
Read up on the ruling here.