(11) بَابُ قَوْلِ النَّبِيِّ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ: «إِذَا رَأَيْتُمُ الْهِلاَلَ فَصُومُوا وَإِذَا رَأَيْتُمُوهُ فَأَفْطِرُوا»
Narrated Anas:
Allah's Messenger (ﷺ) vowed to keep aloof from his wives for one month, and he had dislocation of his leg. So, he stayed in a Mashruba for 29 nights and then came down. Some people said, "O Allah's Messenger (ﷺ)! You vowed to stay aloof for one month," He replied, "The month is of 29 days."
Reference: Sahih al-Bukhari 1911
In-book reference: Book 30, Hadith 21
USC-MSA web (English) reference(deprecated numbering scheme): Vol. 3, Book 31, Hadith 135