The Qur’an is categorical in stating that none but Allah knows the time of the Last Hour (i.e., the Day of Judgment). It also establishes that even Prophet Muhammad (ﷺ) did not know of it. Hadith reports also mention that the Prophet (ﷺ) stated that he had not been informed of it, though he described its signs.
Against this, a hadith report looks odd in giving the impression that the Prophet (ﷺ) had once pointed to a certain boy and said that the Last Hour would come during his lifetime. A narration of the hadith goes as:
عن أنس بن مالك، أن رجلا سأل النبي صلى الله عليه وسلم، قال: متى تقوم الساعة؟ قال: فسكت رسول الله صلى الله عليه وسلم هنيهة، ثم نظر إلى غلام بين يديه من أزد شنوءة، فقال: «إن عمر هذا، لم يدركه الهرم حتى تقوم الساعة» قال: قال أنس: ذاك الغلام من أترابي يومئذ
Anas b. Malik reported that a person asked Allah’s Apostle (ﷺ): When would the Last Hour come? Thereupon Allah’s Messenger (may peace be upon him) kept quiet for a while. Then looked at a young boy in his presence belonging to the tribe of Azd Shanu’a, and he said: If this boy lives, he would not grow very old till the Last Hour would come to you. Anas said that this young boy was of our age during those days.
So did the Prophet (ﷺ) give an estimated time for the setting of the Last Hour, and it proved wrong? Far from it. The impression is based on an isolated reading of the narration. If, however, we look at other reports from the Prophet (ﷺ) both about the idea and question about the time of the Hour and the specific context to these words reported from him, the misgiving is readily addressed.
A narration of the hadith with Abu Ya’la al-Mawsali gives fuller context and details of the Prophet’s (ﷺ) sayings.
عن أنس، أن رجلا قال للنبي صلى الله عليه وسلم: متى الساعة؟ فقال رسول الله صلى الله عليه وسلم: «أما إنها قائمة، فماذا أعددت لها؟» قال: ما أعددت لها كبيرا، إلا أني أحب الله ورسوله، قال رسول الله صلى الله عليه وسلم: «فأنت مع من أحببت، ولك ما احتسبت» ثم قال: «تسألوني عن الساعة والذي نفسي بيده، ما على الأرض نفس منفوسة اليوم تأتي عليها مائة سنة» قال فصلى رسول الله صلى الله عليه وسلم، ثم قال: «أين السائل عن الساعة» فجيء بالرجل ترعد فرائصه، فنظر رسول الله صلى الله عليه وسلم إلى غلام من دوس يقال له سعد، فقال: «إن يعش هذا لا يهرم حتى تقوم الساعة» قال أنس: وأنا يومئذ قدر الغلام
Narrated Anas: A man asked the Prophet (ﷺ): When will the Hour be established? The Messenger of Allah (ﷺ) replied: Perhaps it is about to set; what have you prepared for it? He said: I haven’t prepared much for it except that I love Allah and His Messenger. So the Messenger of Allah (ﷺ) said: “You would be those you love and get what you seek.” Further, he said, “You ask me about the Hour, by Him in whose hand my soul is, there is no one living today who will survive a hundred years.” Then the Messenger of Allah (ﷺ) prayed and asked, “Where is the one who asked about the Hour?” He was brought while he trembled. The Messenger of Allah (ﷺ) looked towards a boy from the tribe of Daws, whose name was Sa‘d and said, “If he should live, the Hour will come before he is senile.” Anas said, “I was the boy’s age then.”
Another narration of the same report clarifies that the Prophet (ﷺ) meant the death of the people of the generation of which a person asked the question. It has that pointing towards the boy, the Prophet (ﷺ) said:
إن هذا عمر حتى يأكل عمره لم يبق منكم عين تطرف
None of you will remain alive if he goes on to live to an advanced age.
In these two narrations of the report related from one companion, i.e., Anas, the alternate of “not remaining alive” and “establishing of Hour” confirms the latter’s meaning.
Similar reports have come from Jabir b. ‘Abdullah and Abu Sa‘id al-Khudri. Another companion Abu Mas‘ud ‘Uqba b. ‘Amr also related it from the Prophet (ﷺ) and ‘Ali b. Talib assured him that the Prophet (ﷺ) had stated it about specific people alive then and that Islam would continue to flourish beyond a hundred years after the Prophet (ﷺ).
It is likewise evident from ‘Aisha’s report of the episode. Al-Bukhari relates:
عن هشام، عن أبيه، عن عائشة، قالت: كان رجال من الأعراب جفاة، يأتون النبي صلى الله عليه وسلم فيسألونه: متى الساعة؟ فكان ينظر إلى أصغرهم فيقول: «إن يعش هذا لا يدركه الهرم حتى تقوم عليكم ساعتكم»، قال هشام: يعني موتهم
On the authority of Hisham, on the authority of his father (i.e., ‘Urwa), on the authority of ‘Aisha who said: Some coarse men of the Bedouins came to the Prophet (ﷺ), and asked him, “When will the Final Hour come?” He looked at the youngest of them and said, “If this one should live, then your Hour will come to you before he is senile.” Hisham said that he meant their death by that.
Here the construction “your Hour” (sā‘atukum) and “come to you” (taqūma ‘alaikum) confirms the reference to specific individuals/addressees at that time. Moreover, Hisham, a prominent narrator, clearly mentioned that it referred to their death.
Relatable to this is a statement of Mughira b. Shu’ba:
عن المغيرة بن شعبة، قال: يقولون: القيامة القيامة، وإنما قيامة أحدهم: موته.
People keep talking about the Hour. Verily an individual’s Hour is his death.
Based on this, the statement, “He who has died, his Hour has come” (man māta faqad qāma qiyāmatuhu), is well-known in the Islamic discourse. Whereas its verbatim attribution to the Prophet (ﷺ) is dubious, it is reported, besides Mughira, from ‘Alqama b. Qais – a student of the senior Companions– and ‘Umar b. ‘Abdul’ Aziz. Later scholars have also attested to its meanings, including its conformity with the report of ‘Aisha mentioned above.
It is, therefore, clear that far from a failed prophecy, the Prophet (ﷺ) gave some essential lessons to believers in the report under discussion.
Firstly, the Prophet (ﷺ) meant to educate people that knowing the time of the coming of the Hour is of no good to any individual. It is also a reason Allah has not shared this with anyone, not even the Last and Final Prophet, Muhammad (ﷺ).
Secondly, he meant to make people realize that since the time to act and correct one’s attitude vis-à-vis Allah’s commands ends with the departure from this world to the other, the instant of a person’s death was effectively the time the Hour would be established for him.
In consideration of these points and reflecting on the query above, the takeaway is that as the hadith reports are disjoint pieces of information, a corroborated and collated study of all the relevant narrations is imperative before making an opinion on impressions of inconsistency and discrepancy.
 See Qur’an 7:187; 33:63; 31:34;
 Al-Bukhari, al-Sahih, Hadith 50; 4777; Muslim b. Hajjaj, al-Sahih, Hadith 1
 Muslim b. Hajjaj, al-Sahih, Hadith 2953-138
 al-Mawsali, Abu Ya‘la, al-Musnad, Ed. Hussain Salim Asad (Damascus: Dar al-Ma’mun, 1984) Hadith 2758; also, Al-Bukhari, al-Sahih, Hadith 6167;
 Al-Mawsali, Abu Ya‘la, al-Musnad, Hadith 4049
 Muslim b. Hajjaj, al-Sahih, Hadith 2538-218
 Muslim b. Hajjaj, al-Sahih, Hadith 2539-219
 Ahmad b. Hanbal, al-Musnad, Ed. Shu‘aib al-Arna’ut (Beirut: al-Resalah Publisher, 2001) Hadith 714 – graded as strong (qawi)
 Al-Bukhari, al-Sahih, Hadith 6511
 Al-Tabari, Abu Ja‘far, Jami‘ al-Bayan ‘an Ta’wil ay al-Qur’an, Ed. Ahmad Muhammad Shakir (Beirut: Resalah Publishers, 2000) Vol.24, 49; al-Dawlabi, al-Kuna wa al-Asma’, (Beirut: Dar Ibn Hazm, 2000) no. 1627
 Muhammad ‘Amr b. ‘Abdul Latif, Tabyid al-Saḥīfa bi Usul al-Ahādīth al-Da‘īfa, (Cairo: Maktaba al-Taw‘iya al-Islamiyya, 1410 AH) Vol.1, 127-129
 Al-Yahsubi, Qadi ‘Iyad, Mashariq al-Anwar ‘ala Sihah al-Athar, (Cairo: Dar al-Turath, 1333 AH) Vol.1, 359; Ibn Taymiyya, al-Istiqama, (Madina: Jami’a al-Imam Muhammad b. Sa‘ud, 1403) Vol.1, 67; Ibn Kathir, al-Nihaya fi al-Fitan wa al-Malahim, (Beirut: Dar al-Jīl, 1988) Vol.1, 31; Al-Qari’, Mulla ‘Ali, Mirqat al-Mafatih Sharh Mishkat al-Masabih, (Beirut: Dar al-Fekr, 2002) Vol.1, 62; Usmani, Muhammad Rafi, ‘Alamat e Qiyamat aur Nuzul e Masih, (Karachi: Maktaba Darul ‘Ulum, 2010) 147-148
 Al-‘Asqalani, Ibn Hajar, Fath al-Bari Sharh Sahih al-Bukhari, (Beirut: Dar al-Ma‘rifa, 1379 AH) Vol.10, 556-557