The Messenger of Allah ﷺ said, "When you see the crescent moon, begin fasting, and when you see it again, end your fast. If it is hidden from you by clouds, then complete thirty days of fasting."
أخبرنا محمد بن يحيى بن عبد الله النيسابوري قال حدثنا سليمان بن داود قال حدثنا إبراهيم عن محمد بن مسلم عن سعيد بن المسيب
أن رسول الله ﷺ قال إذا رأيتم الهلال فصوموا وإذا رأيتموه فأفطروا فإن غم عليكم فصوموا ثلاثين يوما
Muslim narrated it in the Book of Fasting, chapter on the obligation of fasting Ramadan upon sighting the crescent moon, etc., no. 1081, from the hadith of Ibrahim bin Saad, from Muhammad bin Muslim Zuhri, with this wording. It is also found in Sunan al-Kubra, no. 2429.