I want to calculate real time of midnight (Solar midnight), but I am unable to find any formula or algorithm for that. I have times of sunrises and sunsets for every day of year. How can I get Solar midnight times from them?
Thank you all.
The formula for calculating the Local Time equivalent for Local Solar Time is $LST=LT+\frac{TC}{60}$, where $TC$ is the Time Correction factor $TC=4(Longitude-LSTM)+EoT$. $LSTM$ is the Local Solar Time Meridian, calculated by $15º-ΔT_{GMT}$, where $ΔT_{GMT}$ is the difference, in hours, from GMT. (For instance, here on the east coast of the US, this value is -4 in the summer and -5 in the winter.) $EoT$ is the Equation of Time, $EoT=9.87sin(2B)-7.53cos(B)-1.5sin(B)$, where $B=\frac{360}{365}((day\ of\ year)-81)$.
If you rearrange that first equation to calculate $LT$ in terms of $LST$, you'll get $LT=LST-\frac{TC}{60}$. Set $LST$ to 12 to calculate solar noon and 24 to calculate solar midnight.
Equations from here.
Maybe finding the Julian date will help you. Julian days are used for astronomical purposes. Every day midnight occurs exactly when the J.D. (Julian date) is *.5. So you can convert the J.D. to U.T. (Universal time) and then to your local time.
sun_altitude(time) = known_altitude
equation. $\endgroup$