<p>The HORIZONS web interface allows for you to change the observer location to other bodies in the solar system.  <a href="https://ssd.jpl.nasa.gov/horizons.cgi#top" rel="nofollow noreferrer">Select &quot;Observer location [change]</a> 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 &quot;Viking 1@499&quot;.  Mars is designated by &quot;@499&quot; 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.</p>
<p>To determine when the Sun rises and sets on Mars, you'll also need to change the columns returned to include &quot;Apparent AZ/EL&quot; (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.</p>
<p><a href="https://i.sstatic.net/9jECb.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/9jECb.png" alt="enter image description here" /></a></p>

CC BY-SA 4.0
2020-08-17T16:27:52.440Z
Thanks, I widely know Horizons, I am even trying to setup a Graphical User Interface for it ( http://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...
jumpjack
CC BY-SA 4.0
2020-08-18T17:06:12.020Z
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.
AstroShannon
CC BY-SA 4.0
2020-08-18T17:13:48.560Z
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 ( http://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...
jumpjack
CC BY-SA 4.0
2020-08-18T17:17:51.630Z
Other possible sources for algorithms: https://www.aresastro.com/2016/09/utc-to-mtc-conversion-in-excel/    ,  https://gist.github.com/danopia/3441f45e60f36e19e77782ad760dec0f     And I wonder if these are the constants I am lookinùg for (from page 8): https://link.springer.com/epdf/10.1007/s10569-017-9805-5?author_access_token=pcbs1gV_DYhP9yhmAYezFPe4RwlQNchNByi7wbcMAY6HRRN_JGkCH_CXrmP6w-LLXlanSQWWDo6B6Yb0vVQo5UJybROqEAn3dWfKapiaqajv2hJnIdrYZz0dRSCoaVszFbGvpOxn-3Iboajxlxffmw%3D%3D  They are also available in NAIF kernels: https://naif.jpl.nasa.gov/pub/naif/JUNO/kernels/pck/pck00008.tpc
jumpjack
CC BY-SA 4.0
2020-08-18T17:21:04.713Z
This paper will show you exactly how to calculate those values for Mars (along with the equation of time): https://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: https://www.giss.nasa.gov/tools/mars24/
AstroShannon
CC BY-SA 4.0
2020-08-19T08:05:37.017Z
I well know mars24 clock; the right page to look at is this: https://www.giss.nasa.gov/tools/mars24/help/algorithm.html  But all numbers are without comments, so the hard part is to figure out how each number changes on different celestial bodies!
jumpjack
CC BY-SA 4.0
2020-08-09T19:55:53.293Z
2020-08-09T20:04:20.740Z
2020-08-09T20:04:20.740Z
AstroShannon
<p>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:</p>
<p><a href="https://www.aa.quae.nl/en/reken/zonpositie.html" rel="nofollow noreferrer">https://www.aa.quae.nl/en/reken/zonpositie.html</a></p>
<p><a href="https://i.sstatic.net/CCDnE.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/CCDnE.png" alt="Position of the Sun in the sky from any planet's surface" /></a></p>
<p>This page shows and explains Analemma and Equation of Time for Earth, and shows analemmas for all planets:</p>
<p><a href="http://pbarbier.com/eqtime/eqtime.html" rel="nofollow noreferrer">http://pbarbier.com/eqtime/eqtime.html</a></p>

CC BY-SA 4.0
2020-08-19T17:25:25.743Z
2020-08-19T17:25:25.743Z
jumpjack
<p>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 &quot;local solar time&quot;; indeed, Horizons allows asking for such an output... but currently output is jut &quot;n/a&quot; for bodies other than Earth:</p>
<pre><code>*******************************************************************************
 Date__(UT)__HR:MN, , , L_Ap_Sid_Time,  L_Ap_SOL_Time,  L_Ap_Hour_Ang,
**********************************************************************
$$SOE
 2020-Aug-09 10:51,*,x,          n.a.,           n.a.,           n.a.,
 2020-Aug-09 11:51,*,x,          n.a.,           n.a.,           n.a.,
</code></pre>
<p>Url to ask for quantities 7, 34 and 42 (note: only 42 is declared as &quot;Earth surface only&quot;).</p>
<p><a href="https://ssd.jpl.nasa.gov/horizons_batch.cgi?batch=1&amp;COMMAND=%27-85%27&amp;CENTER=%27coord@301%27&amp;OBJ_DATA=%27yes%27&amp;MAKE_EPHEM=%27yes%27&amp;TABLE_TYPE=%27OBSERVER%27&amp;REF_PLANE=%27ECLIPTIC%27&amp;COORD_TYPE=%27GEODETIC%27&amp;SITE_COORD=%2723.4729700,0.67417634,0%27&amp;START_TIME=%272020/8/9%2010:51%27&amp;STOP_TIME=%272020/8/10%2010:51%27&amp;STEP_SIZE=%271h%27&amp;QUANTITIES=%277,34,42%27&amp;FIXED_QUANTITIES=%27Custom%27&amp;REF_SYSTEM=%27J2000%27&amp;OUT_UNITS=%27KM-S%27&amp;VECT_TABLE=%273%27&amp;VECT_CORR=%27NONE%27&amp;CAL_FORMAT=%27CAL%27&amp;ANG_FORMAT=%27HMS%27&amp;APPARENT=%27AIRLESS%27&amp;TIME_TYPE=%27UTC%27&amp;TIME_DIGITS=%27MINUTES%27&amp;RANGE_UNITS=%27AU%27&amp;SUPPRESS_RANGE_RATE=%27no%27&amp;SKIP_DAYLT=%27no%27&amp;EXTRA_PREC=%27yes%27&amp;CSV_FORMAT=%27yes%27&amp;VEC_LABELS=%27yes%27&amp;ELM_LABELS=%27yes%27&amp;TP_TYPE=%27ABSOLUTE%27&amp;R_T_S_ONLY=%27NO%27&amp;CA_TABLE_TYPE=%27STANDARD%27" rel="nofollow noreferrer">https://ssd.jpl.nasa.gov/horizons_batch.cgi?batch=1&amp;COMMAND=%27-85%27&amp;CENTER=%27coord@301%27&amp;OBJ_DATA=%27yes%27&amp;MAKE_EPHEM=%27yes%27&amp;TABLE_TYPE=%27OBSERVER%27&amp;REF_PLANE=%27ECLIPTIC%27&amp;COORD_TYPE=%27GEODETIC%27&amp;SITE_COORD=%2723.4729700,0.67417634,0%27&amp;START_TIME=%272020/8/9%2010:51%27&amp;STOP_TIME=%272020/8/10%2010:51%27&amp;STEP_SIZE=%271h%27&amp;QUANTITIES=%277,34,42%27&amp;FIXED_QUANTITIES=%27Custom%27&amp;REF_SYSTEM=%27J2000%27&amp;OUT_UNITS=%27KM-S%27&amp;VECT_TABLE=%273%27&amp;VECT_CORR=%27NONE%27&amp;CAL_FORMAT=%27CAL%27&amp;ANG_FORMAT=%27HMS%27&amp;APPARENT=%27AIRLESS%27&amp;TIME_TYPE=%27UTC%27&amp;TIME_DIGITS=%27MINUTES%27&amp;RANGE_UNITS=%27AU%27&amp;SUPPRESS_RANGE_RATE=%27no%27&amp;SKIP_DAYLT=%27no%27&amp;EXTRA_PREC=%27yes%27&amp;CSV_FORMAT=%27yes%27&amp;VEC_LABELS=%27yes%27&amp;ELM_LABELS=%27yes%27&amp;TP_TYPE=%27ABSOLUTE%27&amp;R_T_S_ONLY=%27NO%27&amp;CA_TABLE_TYPE=%27STANDARD%27</a></p>
<p>So I tried to setup my own page ( <a href="http://win98.altervista.org/space/exploration/moon/moontime.html" rel="nofollow noreferrer">http://win98.altervista.org/space/exploration/moon/moontime.html</a> ), which makes its calculations starting from &quot;colongitude&quot; and moon terminator longitude, but it completely disregards observer latitude and altitude.</p>
<p><strong>Any suggestion about pages which perform these calculations?</strong></p>
<hr />
<p>My GUI for NASA Horizons:
<a href="http://win98.altervista.org/space/exploration/NHUGUI.html" rel="nofollow noreferrer">http://win98.altervista.org/space/exploration/NHUGUI.html</a></p>
<p>To specify a location on another body, write &quot;coord@body&quot; in &quot;CENTER&quot; field, without changing &quot;COMMAND&quot; field, which will be ignored, and write the triplet &quot;lon, lat, alt&quot; in field SITE_COORD.</p>
<p>To find predefined sites on a body use *<strong>@body</strong> , for example *<strong>@301</strong> will list Moon landing aites.</p>

CC BY-SA 4.0
2020-08-09T09:55:58.313Z
Dunno about your use case. Did you checkout Stellarium and try to place yourself onto another body?
planetmaker
CC BY-SA 4.0
2020-08-09T10:03:40.043Z
I'd need an online resource which I can programmatically access from my page.
jumpjack
CC BY-SA 4.0
2020-08-09T12:07:14.613Z
It's probably me but I can't figure out the exact question here. Is it alt/az of the Sun (or other planet) from a topographical coordinate on a planet? You don't need "local time" right, UTC or TDB is okay? It would be great if you improved the title to reflect a specific question if possible. *Thanks!*
uhoh
CC BY-SA 4.0
2020-08-09T12:10:57.340Z
For example, I got the alt/az of the Sun at specific times for two Apollo landing sites in [this answer](https://space.stackexchange.com/a/37155/12102) and I think there are topocentric coordinates for most planets in Horizons. What's missing exactly? The Python package [Skyfield](https://rhodesmill.org/skyfield/) is under rapid development and can do a lot already, but I don't know if there's a `Topos()` method for bodies other than the Earth yet.
uhoh
CC BY-SA 4.0
2020-08-17T16:32:26.077Z
@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?
jumpjack
CC BY-SA 4.0
2020-08-17T16:38:20.157Z
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).
jumpjack
CC BY-SA 4.0
2020-08-17T16:47:58.367Z
https://www.courses.psu.edu/astro/astro001_pjm25/sun.ht1.jpg
jumpjack
CC BY-SA 4.0
2020-08-17T17:05:45.763Z
Just found this site; this would be an amazing way of representing time on celestial bodies.... http://andrewmarsh.com/apps/staging/sunpath3d.html
jumpjack
CC BY-SA 4.0
2020-08-17T19:02:39.707Z
If I understand correctly, I should "port" Equation of Time to other planets: https://gist.github.com/danopia/3441f45e60f36e19e77782ad760dec0f it's "just" a matter of replacing Earth constants by OtherPlanet's constants...
jumpjack
CC BY-SA 4.0
2020-08-19T17:21:53.097Z
I found the "ultimate resource for timekeeping on any planet": http://aa.quae.nl/en/reken/zonpositie.html Now I have "just" to turn it into a javascript library...
jumpjack
<the-moon><time>
Timekeeping on other celestial bodies than Earth
jumpjack
# Timekeeping on other celestial bodies than Earth

(Asked by: username_0 on 2020-08-09)

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,
**********************************************************************
$$SOE
 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").
https://ssd.jpl.nasa.gov/horizons_batch.cgi?batch=1&COMMAND=%27-85%27&CENTER=%27coord@301%27&OBJ_DATA=%27yes%27&MAKE_EPHEM=%27yes%27&TABLE_TYPE=%27OBSERVER%27&REF_PLANE=%27ECLIPTIC%27&COORD_TYPE=%27GEODETIC%27&SITE_COORD=%2723.4729700,0.67417634,0%27&START_TIME=%272020/8/9%2010:51%27&STOP_TIME=%272020/8/10%2010:51%27&STEP_SIZE=%271h%27&QUANTITIES=%277,34,42%27&FIXED_QUANTITIES=%27Custom%27&REF_SYSTEM=%27J2000%27&OUT_UNITS=%27KM-S%27&VECT_TABLE=%273%27&VECT_CORR=%27NONE%27&CAL_FORMAT=%27CAL%27&ANG_FORMAT=%27HMS%27&APPARENT=%27AIRLESS%27&TIME_TYPE=%27UTC%27&TIME_DIGITS=%27MINUTES%27&RANGE_UNITS=%27AU%27&SUPPRESS_RANGE_RATE=%27no%27&SKIP_DAYLT=%27no%27&EXTRA_PREC=%27yes%27&CSV_FORMAT=%27yes%27&VEC_LABELS=%27yes%27&ELM_LABELS=%27yes%27&TP_TYPE=%27ABSOLUTE%27&R_T_S_ONLY=%27NO%27&CA_TABLE_TYPE=%27STANDARD%27
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.

**Tags:** the-moon, time
> **Comments:**
> **username_1**: Dunno about your use case. Did you checkout Stellarium and try to place yourself onto another body?  
> **username_0**: I'd need an online resource which I can programmatically access from my page.  
> **username_2**: It's probably me but I can't figure out the exact question here. Is it alt/az of the Sun (or other planet) from a topographical coordinate on a planet? You don't need "local time" right, UTC or TDB is okay? It would be great if you improved the title to reflect a specific question if possible. *Thanks!*  
> **username_2**: For example, I got the alt/az of the Sun at specific times for two Apollo landing sites in [this answer](https://space.stackexchange.com/a/37155/12102) and I think there are topocentric coordinates for most planets in Horizons. What's missing exactly? The Python package [Skyfield](https://rhodesmill.org/skyfield/) is under rapid development and can do a lot already, but I don't know if there's a `Topos()` method for bodies other than the Earth yet.  
> **username_0**: @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?  
> **username_0**: 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).  
> **username_0**: https://www.courses.psu.edu/astro/astro001_pjm25/sun.ht1.jpg  
> **username_0**: Just found this site; this would be an amazing way of representing time on celestial bodies.... http://andrewmarsh.com/apps/staging/sunpath3d.html  
> **username_0**: If I understand correctly, I should "port" Equation of Time to other planets: https://gist.github.com/danopia/3441f45e60f36e19e77782ad760dec0f it's "just" a matter of replacing Earth constants by OtherPlanet's constants...  
> **username_0**: I found the "ultimate resource for timekeeping on any planet": http://aa.quae.nl/en/reken/zonpositie.html Now I have "just" to turn it into a javascript library...  

---

## 2 answers

### Answer by username_3 on 2020-08-09. Score: 4

The HORIZONS web interface allows for you to change the observer location to other bodies in the solar system. [Select "Observer location [change]](https://ssd.jpl.nasa.gov/horizons.cgi#top) 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](https://i.sstatic.net/9jECb.png)](https://i.sstatic.net/9jECb.png)

> **Comments:**
> **username_0**: Thanks, I widely know Horizons, I am even trying to setup a Graphical User Interface for it ( http://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...  
> **username_3**: 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.  
> **username_0**: 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 ( http://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...  
> **username_0**: Other possible sources for algorithms: https://www.aresastro.com/2016/09/utc-to-mtc-conversion-in-excel/    ,  https://gist.github.com/danopia/3441f45e60f36e19e77782ad760dec0f     And I wonder if these are the constants I am lookinùg for (from page 8): https://link.springer.com/epdf/10.1007/s10569-017-9805-5?author_access_token=pcbs1gV_DYhP9yhmAYezFPe4RwlQNchNByi7wbcMAY6HRRN_JGkCH_CXrmP6w-LLXlanSQWWDo6B6Yb0vVQo5UJybROqEAn3dWfKapiaqajv2hJnIdrYZz0dRSCoaVszFbGvpOxn-3Iboajxlxffmw%3D%3D  They are also available in NAIF kernels: https://naif.jpl.nasa.gov/pub/naif/JUNO/kernels/pck/pck00008.tpc  
> **username_3**: This paper will show you exactly how to calculate those values for Mars (along with the equation of time): https://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: https://www.giss.nasa.gov/tools/mars24/  
> **username_0**: I well know mars24 clock; the right page to look at is this: https://www.giss.nasa.gov/tools/mars24/help/algorithm.html  But all numbers are without comments, so the hard part is to figure out how each number changes on different celestial bodies!  

---

### Answer by username_0 on 2020-08-19. Score: -1

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:

<https://www.aa.quae.nl/en/reken/zonpositie.html>

[![Position of the Sun in the sky from any planet's surface](https://i.sstatic.net/CCDnE.png)](https://i.sstatic.net/CCDnE.png)

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

<http://pbarbier.com/eqtime/eqtime.html>


---

