I have looked for months for any site capable of calculating solar altitude w.r.t an observer located on the surface of a generic celestial bodies, but with no luck as of now. Even NASA does not provide such information in its Horizons page/software, although technically Horizons contains all the needed data to calculate "local solar time"; indeed, Horizons allows asking for such an output... but currently output is jut "n/a" for bodies other than Earth:

 Date__(UT)__HR:MN, , , L_Ap_Sid_Time,  L_Ap_SOL_Time,  L_Ap_Hour_Ang,
 2020-Aug-09 10:51,*,x,          n.a.,           n.a.,           n.a.,
 2020-Aug-09 11:51,*,x,          n.a.,           n.a.,           n.a.,

Url to ask for quantities 7, 34 and 42 (note: only 42 is declared as "Earth surface only").


So I tried to setup my own page ( http://win98.altervista.org/space/exploration/moon/moontime.html ), which makes its calculations starting from "colongitude" and moon terminator longitude, but it completely disregards observer latitude and altitude.

Any suggestion about pages which perform these calculations?

My GUI for NASA Horizons: http://win98.altervista.org/space/exploration/NHUGUI.html

To specify a location on another body, write "coord@body" in "CENTER" field, without changing "COMMAND" field, which will be ignored, and write the triplet "lon, lat, alt" in field SITE_COORD.

To find predefined sites on a body use *@body , for example *@301 will list Moon landing aites.

  • $\begingroup$ Dunno about your use case. Did you checkout Stellarium and try to place yourself onto another body? $\endgroup$ Commented Aug 9, 2020 at 9:55
  • $\begingroup$ I'd need an online resource which I can programmatically access from my page. $\endgroup$
    – jumpjack
    Commented Aug 9, 2020 at 10:03
  • 1
    $\begingroup$ @uhoh If you were at Curiosity landing site, a quick look at the sun would tell you apprximately if it's morning, noon or afternoon, and how far in time the sunset is. I would like to give the user such a raw idea of local time for each site. If it's 15:30, assuming a "standard sunset" at 18:00, there would be just a few hours to the sunset. But the "standard sunset at 18:00" is itself weird...: how do I take seasons into account while calculating time on planets? Sun does not always set at 18.00, sunset time varies. How much on Mars? $\endgroup$
    – jumpjack
    Commented Aug 17, 2020 at 16:32
  • 1
    $\begingroup$ For example, on Earth if the sun is at 10° altitude, it could be 17:00 or 18:00 or even 20:00 depending on season (probably 17:00 in January and 20:00 in July). $\endgroup$
    – jumpjack
    Commented Aug 17, 2020 at 16:38
  • 1
    $\begingroup$ courses.psu.edu/astro/astro001_pjm25/sun.ht1.jpg $\endgroup$
    – jumpjack
    Commented Aug 17, 2020 at 16:47

2 Answers 2


The HORIZONS web interface allows for you to change the observer location to other bodies in the solar system. Select "Observer location [change] and read the instructions carefully. I was able to generate an ephemeris showing the Sun's position for the Viking lander location by entering in "Viking 1@499". Mars is designated by "@499" and it allows you to enter in any Mars surface coords (Mars lat/long) before the @499 to generate the ephemeris. There is a search function to find the code for nearly anything in the solar system; it will always be @ something.

To determine when the Sun rises and sets on Mars, you'll also need to change the columns returned to include "Apparent AZ/EL" (azimuth and elevation over the horizon). Also, you'll want to have it run for the accuracy you're looking for, such as every 5 mins or every 1 min, etc. Here is a screenshot using 10 mins for the step time.

enter image description here

  • $\begingroup$ Thanks, I widely know Horizons, I am even trying to setup a Graphical User Interface for it ( win98.altervista.org/space/exploration/NHUGUI.html ), and it's right by using it that I found that Local Sidereal Time (quantity 7) and Local Solar Time (quantity 34) are currently N/A for all bodies but Earth. I already contacted the authors in 2019 as I think that's a bug, and they replied that they actually already have all needed data to calculate these data, so they will implement them... sooner or later... $\endgroup$
    – jumpjack
    Commented Aug 17, 2020 at 16:27
  • $\begingroup$ Are you doing the calculations or will your website query Horizons? Since Horizons already provides an RA/dec (and alt/az) for the Sun as viewed from the surface of Mars (or other bodies), are you trying to find the sidereal and local solar time for other calculations? I saw in another one of your comments you are thinking of calculating the equation of time for other celestial bodies and had linked to code that follows equations given by Jean Meeus in "Astronomical Algorithms". Those books are a must have for anyone interested in these types of calculations, I highly recommend them. $\endgroup$ Commented Aug 18, 2020 at 17:06
  • $\begingroup$ If/when Horizons would provide local solar/sideral time data, I would be glad to use them as a "certified source", but in lack of them, I am trying to figure out how to calculate them by myself starting from Alt/Az or other data, but it appears to be a very hard task. Maybe sunpath3d source could help ( dev.4dialog.com/sun/earthsun.html ), as probably it would be just a matter of replacing right constants in the source... but as of now I can't yet understand if source code is public or not. And, above all, which constants to replace, and by which values... $\endgroup$
    – jumpjack
    Commented Aug 18, 2020 at 17:13
  • $\begingroup$ Other possible sources for algorithms: aresastro.com/2016/09/utc-to-mtc-conversion-in-excel , gist.github.com/danopia/3441f45e60f36e19e77782ad760dec0f And I wonder if these are the constants I am lookinùg for (from page 8): link.springer.com/epdf/10.1007/… They are also available in NAIF kernels: naif.jpl.nasa.gov/pub/naif/JUNO/kernels/pck/pck00008.tpc $\endgroup$
    – jumpjack
    Commented Aug 18, 2020 at 17:17
  • $\begingroup$ This paper will show you exactly how to calculate those values for Mars (along with the equation of time): pubs.giss.nasa.gov/docs/1997/1997_Allison_al04000r.pdf Once you know how to calculate them for locations other than Earth, you can calculate them for nearly anywhere. You can check your values for the surface of Mars to this: giss.nasa.gov/tools/mars24 $\endgroup$ Commented Aug 18, 2020 at 17:21

This page contains all the formulas for calculating Sun position in sky as seen from any planet in Solar System, with plenty of details and explanations:


Position of the Sun in the sky from any planet's surface

This page shows and explains Analemma and Equation of Time for Earth, and shows analemmas for all planets:



You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .