Hadith Of Ashra Mubashara
It was a divine decision, therefore Prophet (sws) must’ve been given this knowledge.