Some men from the companions of the Messenger of Allah ﷺ were shown Laylat al-Qadr in their dreams during the last seven nights. The Messenger of Allah ﷺ said, "I see that your dreams agree on the last seven nights, so whoever seeks it should seek it in the last seven nights."
أن رجالا من أصحاب رسول الله ﷺ أروا ليلة القدر في المنام في السبع الأواخر. فقال رسول الله ﷺ: إني أرى رؤياكم قد تواطأت في السبع الأواخر، فمن كان متحريها، فليتحرها في السبع الأواخر.
Malik narrated it in "Itikaf" (14) from Nafi, from Ibn Umar. Bukhari narrated it in "The Merit of Laylat al-Qadr" (2015), and Muslim in "Fasting" (1165:205), both through the route of Malik, with the same wording. Malik also narrated it (11), and through his route Muslim (1165:206), from Abdullah bin Dinar, from Abdullah bin Umar, in a shortened form, with the wording, "Seek out Laylat al-Qadr in the last seven nights."Regarding his saying "the last seven," the apparent meaning is that it refers to the last seven nights of the month. It has also been said that it means the seven nights beginning with the night of the twenty-second and ending with the night of the twenty-eighth. According to the first view, neither the night of the twenty-first nor the twenty-third would be included, while according to the second view only the twenty-second would be included, and the night of the twenty-ninth would not be included. Al-Hafiz said in Fath al-Bari,Then know that the wordings of the hadith of Ibn Umar have varied in different forms. Among them is, "I see that your dreams have agreed upon the last seven nights, so whoever wishes to seek it out should seek it in the last seven nights." This is sahih, and in Muslim it came with different wordings. Another is, "Seek out Laylat al-Qadr in the last seven nights," the report of Abdullah bin Dinar from Ibn Umar. Another is, "I see your dreams as agreeing on the last ten nights, so seek it in the odd nights among them," the report of Salim from his father. Another is, "Some of you were shown that it is in the first seven, and some of you were shown that it is in the last seven, so seek it in the last ten," which is also the report of Salim from his father. Another is, "Seek it in the last ten, and if any of you is weak or unable, let him not be overcome regarding the remaining seven," the report of Uqbah bin Hurayth from Ibn Umar. Another is, "Whoever wishes to seek it, let him seek it in the last ten," the report of Jabalah from Ibn Umar. Another is, "Look for Laylat al-Qadr in the last ten," or he said, "in the last nine," this being the report of Jabalah and Muharib from Ibn Umar.Qurtubi says in al-Mufhim (3/251), after listing some of these reports, "What emerges from the sum of the hadiths, and what the matter of the Messenger of Allah settled upon in seeking it, is that it is in the last ten nights of Ramadan, and that it shifts from year to year. In this way the scattered and differing hadiths concerning its identification come together. This is the view of Malik, Shafii, Thawri, Ahmad, Ishaq, Abu Thawr, and others, as related by Abu Fadl Iyad, so rely on it and hold to it."I say, however, that most of the reports indicate that it is among the odd nights of the last ten, though the reports then differ in specifying which odd nights, as you have seen. So the conclusion is that it falls among the odd nights of the last ten without further specification. It may have occurred, during the time of the Prophet, on one particular odd night within the last ten, but this does not necessarily mean that it continues to fall on that same night until the Day of Judgment.