Zoom and pan as You wish.
click to mark location.
Set date and time difference between local time and UTC (east positive).
Click "accept..."
The "whiskers" show direction to sun rise and sun set.
Map loading...
360) $L=$L-360; if ($L<0) $L=$L+360; //5a. calculate the Sun's right ascension $RA =rad2deg(atan(0.91764 * tan(deg2rad($L)))); // NOTE: RA potentially needs to be adjusted into the range [0,360) by adding/subtracting 360 if ($RA>360) $RA=$RA-360; if ($RA<0) $RA=$RA+360; // 5b. right ascension value needs to be in the same quadrant as L $Lquadrant = (floor($L/90)) * 90; $RAquadrant = (floor($RA/90)) * 90; $RA =$RA + ($Lquadrant - $RAquadrant); //5c. right ascension value needs to be converted into hours $RA = $RA / 15; //6. calculate the Sun's declination $sinDec = 0.39782 * sin(deg2rad($L)); $cosDec = cos(asin($sinDec)); //7a. calculate the Sun's local hour angle $cosH = (cos(deg2rad($zenith)) - ($sinDec * sin(deg2rad($latitude)))) / ($cosDec * cos(deg2rad($latitude))); // if (cosH > 1) // the sun never rises on this location (on the specified date) // if (cosH < -1) // the sun never sets on this location (on the specified date) //7b. finish calculating H and convert into hours // if if rising time is desired: $Hnousu = 360 - rad2deg(acos($cosH)); // if setting time is desired: $Hlasku = rad2deg(acos($cosH)); $H = $Hnousu / 15; //8. calculate local mean time of rising/setting $T = $H + ($RA) - (0.06571 * $t) - 6.622; //9. adjust back to UTC $UT = $T - $lngHour; //NOTE: UT potentially needs to be adjusted into the range [0,24) by adding/subtracting 24 //10. convert UT value to local time zone of latitude/longitude $localT1 = $UT + $localOffset; $locaika=mktime(floor($localT1),round(fmod($localT1,1)*60),0,$month,$day,$year); $locaikastr=date('H:i',$locaika); echo 'Sun rise '.$locaikastr.' degrees:'.round($Hnousu-180).'
'; // nousuaika meni $lolat1=$latitude+cos(($Hnousu-180)/180*3.14159)*1; $lolnd1=$longitude+sin(($Hnousu-180)/180*3.14159)*1; // sitten laskuaika $t=$tlasku; //3. calculate the Sun's mean anomaly $M = (0.9856 * $t) - 3.289; //4. calculate the Sun's true longitude $L = $M + (1.916 * sin(deg2rad($M))) + (0.020 * sin(deg2rad(2 * $M))) + 282.634; $L = $M + (1.916 * sin(deg2rad($M))) + (0.020 * sin(deg2rad(2 * $M))) + 282.634; // NOTE: L potentially needs to be adjusted into the range [0,360) by adding/subtracting 360 if ($L>360) $L=$L-360; if ($L<0) $L=$L+360; //5a. calculate the Sun's right ascension $RA =rad2deg(atan(0.91764 * tan(deg2rad($L)))); // NOTE: RA potentially needs to be adjusted into the range [0,360) by adding/subtracting 360 if ($RA>360) $RA=$RA-360; if ($RA<0) $RA=$RA+360; // 5b. right ascension value needs to be in the same quadrant as L $Lquadrant = (floor($L/90)) * 90; $RAquadrant = (floor($RA/90)) * 90; $RA =$RA + ($Lquadrant - $RAquadrant); //5c. right ascension value needs to be converted into hours $RA = $RA / 15; //6. calculate the Sun's declination $sinDec = 0.39782 * sin(deg2rad($L)); $cosDec = cos(asin($sinDec)); //7a. calculate the Sun's local hour angle $cosH = (cos(deg2rad($zenith)) - ($sinDec * sin(deg2rad($latitude)))) / ($cosDec * cos(deg2rad($latitude))); // if (cosH > 1) // the sun never rises on this location (on the specified date) // if (cosH < -1) // the sun never sets on this location (on the specified date) //7b. finish calculating H and convert into hours // if if rising time is desired: $Hnousu = 360 - rad2deg(acos($cosH)); // if setting time is desired: $Hlasku = rad2deg(acos($cosH)); $H = $Hlasku / 15; //8. calculate local mean time of rising/setting $T = $H + ($RA) - (0.06571 * $t) - 6.622; //9. adjust back to UTC $UT = $T - $lngHour; //NOTE: UT potentially needs to be adjusted into the range [0,24) by adding/subtracting 24 if ($UT>24) $UT=$UT-24; if ($UT<0) $UT=$UT+24; $localT2 = $UT + $localOffset; // echo floor($localT).':'.round(fmod($localT,1)*60).' suunta:'.(180+$Hlasku); $lolat2=$latitude+cos(($Hlasku-180)/180*3.14159)*1; $lolnd2=$longitude+sin(($Hlasku-180)/180*3.14159)*1; $locaika=mktime(floor($localT2),round(fmod($localT2,1)*60),0,$month,$day,$year); $locaikastr=date('H:i',$locaika); $tiedot= 'Sun set '.$locaikastr.' degrees:'.round(180+$Hlasku); echo $tiedot.'
'; ?>
Set date 'dd.mm.yyyy'
Set (local time - UTC) hours