The Messenger of Allah does not know when the Hour will be
Allah commands His Messenger to say to the people that he has no knowledge of when the Hour will be and he does not know whether its time is near or far.
قُلْ إِنْ أَدْرِي أَقَرِيبٌ مَّا تُوعَدُونَ أَمْ يَجْعَلُ لَهُ رَبِّي أَمَدًا
Say;"I know not whether which you are promised is near or whether my Lord will appoint for it a distant term."
meaning, a long period of time.
In this noble Ayah is an evidence that the Hadith that many of the ignorant people often circulate, which says that the Prophet will not remain under the earth more than one thousand years (i.e., the Hour will be before that period) is a baseless lie. We have not seen it in any of the Books (of Hadith).
Verily, the Messenger of Allah was asked about the time of the Hour and he would not respond. When Jibril appeared to him in the form of a Bedouin Arab, one of the questions he asked the Prophet was, "O Muhammad! Tell me about the Hour"
So the Prophet replied,
مَا الْمَسْوُولُ عَنْهَا بِأَعْلَمَ مِنَ السَّايِل
The one questioned about it knows no more than the questioner.
On another occasion when a Bedouin Arab called out to the Prophet in a loud voice saying, "O Muhammad! When will be the Hour"
The Prophet said,
وَيْحَكَ إِنَّهَا كَايِنَةٌ فَمَا أَعْدَدْتَ لَهَا
Woe unto you. Verily, it will occur so what have you prepared for it?
The man replied, "I have not prepared much for it of prayers and fasting, but I love Allah and His Messenger."
The Prophet then replied,
فَأَنْتَ مَعَ مَنْ أَحْبَبْت
Then you will be with whomever you love.
Anas said,
"The Muslims were not happier with anything like they were upon (hearing) this Hadith."
Concerning Allah's statement,
عَالِمُ الْغَيْبِ فَلَا يُظْهِرُ عَلَى غَيْبِهِ أَحَدًا