Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:7:187

They ask you, ˹O Muhammad˺, about the Hour: when is its arrival? Say, "Its knowledge is only with my Lord. None will reveal its time except Him. It lays heavily upon the heavens and the earth. It will not come upon you except unexpectedly." They ask you as if you are familiar with it. Say, "Its knowledge is only with Allah, but most of the people do not know."  

They, that is the people of Mecca, will question you about the Hour, the Resurrection, when it shall come to pass. Say, to them: ‘The knowledge of, when, it, shall be, is only with my Lord. He alone shall reveal it, manifest it, at its proper time (li-waqtihā: the lām here functions as fī, ‘at’). It weighs heavily, tremendously, in the heavens and the earth, upon their inhabitants, because of its awesomeness. It will not come on you save all of a sudden’. They will question you, as if you were preoccupied with, obsessed with inquiring about, it, such that you have come to acquire knowledge of it. Say: ‘Knowledge of it is only with God (innamā ‘ilmuhā ‘inda’Llāhi is for emphasis), but most people do not know’, that knowledge of it lies with God, exalted be He.
القرآن:٧:١٨٧

يَسْأَلُونَكَ عَنِ السَّاعَةِ أَيَّانَ مُرْسَاهَا ۖ قُلْ إِنَّمَا عِلْمُهَا عِنْدَ رَبِّي ۖ لَا يُجَلِّيهَا لِوَقْتِهَا إِلَّا هُوَ ۚ ثَقُلَتْ فِي السَّمَاوَاتِ وَالْأَرْضِ ۚ لَا تَأْتِيكُمْ إِلَّا بَغْتَةً ۗ يَسْأَلُونَكَ كَأَنَّكَ حَفِيٌّ عَنْهَا ۖ قُلْ إِنَّمَا عِلْمُهَا عِنْدَ اللَّهِ وَلَٰكِنَّ أَكْثَرَ النَّاسِ لَا يَعْلَمُونَ  

{يسألونك} أي أهل مكة {عن الساعة} القيامة {أيَّان} متى {مُرساها قل} لهم {إنَّما علمها} متى تكون {عند ربي لا يُجلّيها} يظهرها {لوقتها} اللام بمعنى في {إلا هو ثقُلت} عظمت {في السماوات والأرض} على أهلها لهولها {لا تأتيكم إلا بغتة} فجأة {يسألونك كأنك حَفيٌ} مبالغ في السؤال {عنها} حتى علمتها {قل إنما علمها عند الله} تأكيد {ولكن أكثر الناس لا يعلمون} أن علمها عنده تعالى.