All perfect praise be to Allah, The Lord of the worlds. I testify that there is none worthy of worship except Allah and that Muhammad is His slave and Messenger.
The scholars differed in opinion about burying the dead at night; some of them held that it is permissible without any dislike and some held that it is disliked. Ibn Hazm held that it is prohibited, as stated in his book Al-Muhalla, and Al-Albaani held the same view (as Ibn Hazm) in his book Ahkaam Al-Janaa'iz.
There are many ahaadeeth and narrations from the Companions which prove that burying the dead at night is permissible. Jaabir ibn ‘Abdullah, may Allah be pleased with him, narrated, “People saw a fire (light) in the graveyard, so they went there. They found the Prophet in a grave, and he was saying, ‘Give me your companion.’ It was the man who used to raise his voice with Thikr (remembrance of Allah).” [Abu Dawood - Shu’ayb Al-Arnaa'oot classified it as Hasan (good)]
Ibn al-Qayyim said:
“This fire was for lighting, and therefore Abu Daawood entitled the Chapter: Burial at Night. Imaam Ahmad said, 'There is nothing wrong with that,' and he said that Abu Bakr was buried at night and that 'Ali buried Faatimah at night. Also, ‘Aa’ishah narrated, 'We heard the sound of spades in the last part of the night during the burial of the Prophet .' Among those who were buried at night were ‘Uthmaan, ‘Aa’ishah, and Ibn Mas‘ood.‘Uqbah ibn ‘Aamir gave concession about burying during the night (i.e. he permitted it), as well as Ibn Al-Musayyib, ‘Ataa’, Ath-Thawri, Ash-Shaafi‘i, and Is-haaq. It was judged to be disliked by Al-Hasan and Ahmad in one of his two narrations. Muslim reported in his Saheeh that, 'One day the Prophet delivered a sermon and mentioned one of his Companions, who had died and had been wrapped in a short shroud and buried during the night. The Prophet expressed his disapproval of burying someone at night unless one is compelled to do so.' The statements of the Companions about the permissibility of burying the dead at night are more. At-Tirmithi reported a hadeeth from Al-Hajjaaj ibn Arta'ah from ‘Ataa’ from Ibn ‘Abbaas that, 'The Prophet went into a grave one night, so he was given a lamp. Then he lifted the body from the side toward the Qiblah (prayer direction), saying, 'May Allah be merciful to you. You used to weep a lot and often recited the Quran.' After this, the Prophet said the four Takbeers (i.e. he performed the funeral prayer on him).'At-Tirmithi said, 'The same thing was reported by Jaabir and Zayd ibn Thaabit, and it was the elder brother of Zayd, and the hadeeth by Ibn ‘Abbaas is Hasan (good).' He (At-Tirmithi) said, 'Most scholars considered the burial of the dead at night permissible. The Prophet descended in the grave of Thul-Bijaadayn at night.'Also, Al-Bukhaari reported that the Prophet asked about the grave of a man, and said, 'Who was this?' It was said to him, 'So-and-so; he was buried last night.' So he prayed on him. These ahaadeeth are more in number and more well-known than the hadeeth in Saheeh Muslim. Besides, Muslim and Al-Bukhaari reported that Ibn ‘Abbaas said, 'A person died whom the Messenger of Allah used to visit. He died at night, and (the people) buried him at night. In the morning, they informed him (the Prophet) about his death. He said, 'What prevented you from informing me?' They replied, 'It was such a dark night, and we disliked to trouble you.' So the Prophet went to his grave and offered the (funeral) prayer on him.' It was said that the hadeeth about the disapproval is understood to mean dislike and discipline. What should be said in this regard – and Allah knows best – is that if burying the deceased at night does not lead to neglecting his rights, and it does not lead to not offering the funeral prayer on him, then this is permissible. This is evidenced by the ahaadeeth which indicate the permissibility of burying the dead at night. However, if burying the deceased at night leads to neglecting his rights, not offering the funeral prayer on him, and not taking care of all the requirements of his burial, then in such a case, it is forbidden, and this is what is meant by the disapproval (in the hadeeth reported by Muslim), and Allah is the source of all success."
We consider the view of Ibn Al-Qayyim to be the preponderant one.
As regards the question whether or not there is a recommended time to offer the funeral prayer and to bury the dead, then we are not aware of a special time for this, and none of the scholars mentioned it. The funeral prayer and burial are permissible at all times, with the exception of the times that were specifically forbidden. These times are clarified in the hadeeth of ‘Uqbah ibn ‘Aamir Al-Juhani, may Allah be pleased with him, who said, “The Prophet forbade us from offering the prayer or burying our dead at three times: when the sun rises until it is fully up, at noon when the sun is above one's head until it declines a little, and when the sun declines (is about to set) until it sets.” [Muslim]
Allah knows best.