# Timekeeping on other celestial bodies than Earth

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.

• Dunno about your use case. Did you checkout Stellarium and try to place yourself onto another body? – planetmaker Aug 9 '20 at 9:55
• I'd need an online resource which I can programmatically access from my page. – jumpjack Aug 9 '20 at 10:03
• @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 Aug 17 '20 at 16:32
• 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 Aug 17 '20 at 16:38
• courses.psu.edu/astro/astro001_pjm25/sun.ht1.jpg – jumpjack Aug 17 '20 at 16:47

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.

• 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... – jumpjack Aug 17 '20 at 16:27
• 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 Aug 18 '20 at 17:06
• 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... – jumpjack Aug 18 '20 at 17:13
• 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 – jumpjack Aug 18 '20 at 17:17
• 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 – AstroShannon Aug 18 '20 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:

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

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

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