There are three times during which the Messenger of Allah ﷺ forbade us to pray or to bury our dead: when the sun is rising until it has fully ascended, when the sun is at its zenith until it begins to decline, and when the sun is drawing close to setting until it has set.
ثلاث ساعات كان رسول الله ﷺ ينهانا أن نصلي فيهن أو نقبر فيهن موتانا: حين تطلع الشمس بازغة حتى ترتفع، وحين يقوم قائم الظهيرة حتى تميل الشمس، وحين تضيف الشمس للغروب حتى تغرب.
Muslim reported it in the Book of the Travelers' Prayer (831) from Yahya bin Yahya, who said, Abdullah bin Wahb told us, from Musa bin Ali, from his father, who said, I heard Uqba bin Amir Juhani say, and then he related it.Bayhaqi added in Sunan al-Kubra (4/32), Uqba was asked, "Is burial permitted at night?" He said, "Yes, Abu Bakr was buried at night."Tirmidhi said (1030), "The practice among some of the scholars from the companions of the Prophet ﷺ and others is that they disliked praying the funeral prayer during these hours." Ibn Mubarak said, "The meaning of this hadith is that we may bury our dead during these times," meaning the funeral prayer itself was disliked at sunrise, at sunset, and at midday until the sun passes its zenith. This is the view of Ahmad and Ishaq. Shafii said, "There is no harm in praying the funeral prayer during the hours in which prayer is otherwise disliked."Among those who held that prayer was disliked during the disliked times were Ibn Umar, Ataa, Nakhai, Uzai, Sufyan Thawri, the jurists of the school of legal reasoning, and others.Khattabi said, "The view of the majority is preferable, since it agrees with the hadith."As for the funeral prayer after the dawn prayer and after the Asr prayer, there is no harm in that, as Malik reported in the Book of Funerals (21) from Nafi, that Abdullah bin Umar said, "The funeral prayer may be performed after Asr and after dawn, once those prayers have been performed at their proper times."He also reported from Muhammad bin Abu Harmala, the freed slave of Abdul-Rahman bin Abu Sufyan bin Huwaytib, that Zaynab bint Abu Salama died while Tariq was the governor of Madinah. Her body was brought after the dawn prayer and placed at Baqi. He said that Tariq used to pray the dawn prayer very early, while it was still dark. Ibn Abu Harmala said, I heard Abdullah bin Umar say to her family, "Either pray over your dead now, or leave it until the sun has risen."Malik gave this a chapter heading, "The funeral prayer after dawn until daylight brightens, and after Asr until the sun turns yellow."