Going out of Mina by day and coming back at night during the days of al-Tashreeq
Question

I am from Riyadh, and I want to go for Hajj with some friends of mine from Jeddah. During the days of al-Tashreeq in Mina I want to go to Jeddah to rest, then come back to Mina at night to spend most of the night in Mina, between 10 p.m. and 4 a.m. 
My question is: is it permissible for me to go to Jeddah every day during the days of al-Tashreeq and come back to Mina at night? How many hours of the night must I spend in Mina so that I will have stayed overnight in Mina?.
Praise be to Allah.Firstly:  
The Sunnah is for the pilgrim to stay in Mina throughout the day, following the example of the Prophet (peace and blessings of Allah be upon him), who did not leave Mina except to do Tawaaf al-Ifaadah. And he must stay in Mina for most of the night. 
There is no sin on him if he departs from Mina during the day to go to Makkah or elsewhere, especially if that is because there is no place to stay. 
Shaykh Ibn Baz (may Allah have mercy on him) was asked: A person moved on from ‘Arafat then he stoned the first Jamarah, then he did tawaaf and saa’i, then he stayed in his place in Makkah until ‘Asr, then he went back to Mina and slaughtered his sacrificial animal. Does he have to do anything for this? 
He replied: 
There is no sin on him for that. Whoever stays in Makkah during the day of Eid or during the days of al-Tashreeq in his house or with his companions, there is no sin on him for that. But it is better to stay in Mina if possible, following the example of the Prophet (peace and blessings of Allah be upon him) and his companions (may Allah be pleased with them). If it is not easy for him to do that and it is too difficult for him, and he enters Makkah and stays there during the day, then comes back to Mina at night, and stays there overnight, there is nothing wrong with that. End quote from Majmoo’ Fatawa al-Shaykh Ibn Baz (17/365). 
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) was asked about some of the pilgrims who live in al-Azeeziyyah and stay in their homes during the days of al-Tashreeq. 
He replied: What I think is that those who live in al-Azeeziyyah should not stay in their homes during the day. Undoubtedly it is Sunnah to stay in the tents in Mina, because Hajj is a kind of jihad for the sake of Allah, as the Messenger (peace and blessings of Allah be upon him) said to ‘Aa’ishah (may Allah be pleased with her), when she said: “Is there any jihad for women?” He said: “Yes, a jihad in which there is no fighting: Hajj and ‘Umrah.” So what is prescribed for the pilgrim is to stay in Mina by night and by day. End quote. 
He (may Allah have mercy on him) was also asked: Does going out during the days of al-Tashreeq to places that are close to Makkah, such as Jeddah, affect the Hajj? 
He replied: 
It does not affect the Hajj, but it is better to stay in Mina by night and by day, as the Prophet (peace and blessings of Allah be upon him) did. End quote from Majmoo’ Fatawa al-Shaykh Ibn ‘Uthaymeen (23/241, 242). 
Secondly: 
The guideline on staying in Mina is that the pilgrim should spend more than half the night there. The hours of the night are counted from when the sun sets until when the dawn breaks. 
Based on this, you should work out the time from sunset until dawn, according to the hours in Mina. If you spent six hours in Mina, this is more than half of the night, so you have done what was required. 
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) was asked: What is the length of time that the pilgrim must stay in Makkah during the days of al-Tashreeq? 
He replied: 
The scholars (may Allah have mercy on them) said that staying overnight in Mina must be for most of the night. If we assume that the night is ten hours long, then five and a half hours may be spent in Mina and whatever is more than that is Sunnah. 
End quote from Majmoo’ Fatawa al-Shaykh Ibn ‘Uthaymeen (23/244). 
And Allah knows best.