Sunan an-Nasa'i, Volume 3, Book 22, Hadith 2119 (DarusSalam)

It was narrated that Abu Hurairah said: "the Messenger of Allah said: 'Fast when you see it and stop fasting when you see it, and if it is obscured from you (too cloudy), then count it as thirty (days). "'

أَخْبَرَنَا مُؤَمَّلُ بْنُ هِشَامٍ، عَنْ إِسْمَاعِيلَ، عَنْ شُعْبَةَ، عَنْ مُحَمَّدِ بْنِ زِيَادٍ، عَنْ أَبِي هُرَيْرَةَ، قَالَ قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏ "‏ صُومُوا لِرُؤْيَتِهِ وَأَفْطِرُوا لِرُؤْيَتِهِ فَإِنْ غُمَّ عَلَيْكُمُ الشَّهْرُ فَعُدُّوا ثَلاَثِينَ ‏" ‏ ‏.‏

sunnah.com