This is a live calculation of the time on Mars including mission times for MSL Curiosity and MER-B Opportunity.
Also see my much more recent (and gentle) Orbits Tutorial.
Mouse over a number on the left to get an explanation below
This is the number of milliseconds since
1 January 1970 00:00:00 UTC.
We get this straight from your browser.
This is the number of days (rather than milliseconds) since a much older epoch than Unix time.
Rather than an elaborate conversion from the Gregorian date to the Julian date, we just divide millis by 86,400,000 to get the number of days since the Unix epoch and add that number to 2,440,587.5, the Julian Date at the Unix epoch.
JDUT = 2,440,587.5 + (millis / 8.64 × 107 ms/day)
We actually need the Terrestrial Time (TT) Julian Date rather than the UTC-based one. This means we basically just add the leap seconds which, since ? are ? + 32.184.
JDTT = JDUT + (? + 32.184) / 86,400
This is the number we're going to use as the input to many of our Mars calculations.
It's the number of (fractional) days since
12:00 on 1 January 2000
in Terrestrial Time.
We know what JDTT was at the J2000 epoch (2,451,545.0) so it's trivial to convert.
ΔtJ2000 = JDTT - 2,451,545.0
The equivalent of the Julian Date for Mars is the Mars Sol Date.
At midnight on the 6th January 2000 (ΔtJ2000 = 4.5) it was midnight at the Martian prime meridian, so our starting point for Mars Sol Date is ΔtJ2000 − 4.5.
The length of a Martian day and Earth (Julian) day differ by a ratio of 1.027491252 so we divide by that.
By convention, to keep the MSD positive going back to midday December 29th 1873, we add 44,796.
There is a slight adjustment as the midnights weren't perfectly aligned. Allison, M., and M. McEwen 2000 has −0.00072 but the Mars24 site gives a more up-to-date −0.00096.
MSD = ([(ΔtJ2000 − 4.5) / 1.027491252] + 44,796.0 − 0.00096)
Coordinated Mars Time (or MTC) is like UTC but for Mars. Because it is just a mean time, it can be calculated directly from the Mars Sol Date as follows:
MTC = (24 h × MSD) mod 24
The mean anomaly is a measure of where an orbiting body is in its orbit. More precisely, it's a measure of how far into the full orbit the body is since its last periapsis (the point in the ellipse closest to the focus).
The mean anomaly is the ratio (time-wise) into the full orbit, multiplied by 2π (radians) or 360° although the value doesn't truly correspond to any angle. The mean anomaly is proportional to time (and hence area swept) rather that the actual angle of the body from the focus (which would be the true anomaly).
So the mean anomaly can be calculated from ΔtJ2000 if we know the mean anomaly at the J2000 epoch (19.3870°) and the mean daily motion (360° / length of anomalistic orbit in days).
This gives us:
M = 19.3870° + 0.52402075°ΔtJ2000
Mars goes around the Sun, but viewed from Mars's point of view, the Sun goes around Mars. I'm not talking about the daily motion of the Sun caused by Mars's rotation, but the year-long motion of the Sun viewed from Mars.
Because the orbit is an ellipse, the Sun will go faster some times than others. Imagine a fictitious Sun, though, that took the same Martian year to go around Mars but which orbited at a constant angular velocity (the mean of the real Sun). This is the fictitious mean Sun and it's easier to calculate its angle first because, like the mean anomaly, it is proportional to time.
Based on observations, Allison and McEwen give the angle at J2000 and the daily change (based on tropical orbit period) as 270.3863° and 0.52403840° / day respectively.
This gives us:
αFMS = 270.3863° + 0.52403840°ΔtJ2000
The eccentricity is the deviation of the orbit's ellipse from being a perfect circle. It varies ever so slightly over time and for Mars is given by e = 0.09340 + 2.477 × 10-9 / day ΔtJ2000 = .
The difference between the actual position of the Sun and the fictitious mean Sun is the same as the difference between the true anomaly and mean anomaly. This is called the Equation of Center.
For a two-body Kepler orbit, this difference can be approximated using a Fourier-Bessel series given the mean anomaly M and eccentricity e. This results in:
(10.691° + 3° × 10-7 ΔtJ2000) sin M
+ 0.623° sin 2M
+ 0.050° sin 3M
+ 0.005° sin 4M
+ 0.0005° sin 5M
We're not quite done yet as the above assumes a two-body Kepler motion and we need to include the perturbations caused by other planets previously calculated.
Once they have been added, we have our equation of center.
By adding this to our mean anomaly, M, we also get our true anomaly ν = °
We can now calculate the actual position of the Sun as follows:
LS = αFMS + (ν − M)
Remember, this is not the daily motion of the Sun caused by Mars's rotation, but the year-long motion of the Sun viewed from Mars. Think of it as where Mars is in its orbit around the Sun, flipped around to be from Mars's perspective (hence "areocentric").