How can I calculate gravitational time dilation between two planets? I am writing a school paper and chose to do it about gravitational time dilation. I wanted to calculate the time that passed on Mars when 1000 years on Earth went by. (probably a tiny difference). I have found some formulas like: $$T_\text{dilated}=\sqrt{1−\frac{2Gm}{Rc^2}}⋅T_\text{without gravity}.$$
I think I can use this one, but I am not sure. I also don't understand precisely how it works or which units to do it in to get the correct answer. What is the right way?
 A: Note that
$$U(r) = -GM/r $$
is the gravitational potential energy (per unit mass) at $r$ due to $M$. So the time dilation (relative to infinity), is:
$$ \sqrt{1 + \frac 2{c^2}U} $$
Time dilation depends on the difference in potential energy, so you need to calculate the potential energy due to Sun and Earth's and Mars's orbit. Then for each planet, compute the potential at the surface to get $U_{\rm Earth}$ and $U_{\rm Mars}$, and use their difference in the time dilation formula
Edit: upon further review: the numbers are very close to one, so use:
$$ \sqrt{1-x} \approx 1-\frac 1 2 x $$
Since you only care about the difference from unity, the relevant numbers are:
$$ \delta \tau = \tau_2 -\tau_1 = \sqrt{1-2U_2/c^2} - \sqrt{1-2U_1/c^2}$$
$$ \delta\tau \approx (1-\frac{U_2}{c^2}) - (1-\frac{U_1}{c^2}) =
\frac 1{c^2}(U_1-U_2)$$
So you just need to compute the potential energy difference at the surface...this is a much more numerically stable, btw.
Since the Sun is much more massive than Earth and Mars, you'll find that the orbital position in the solar system dominates the planetary effects by 1-2 orders of magnitude.
A: 
I think I can use this one but I am not sure

Be aware that you have different time dilations on Earth and on Mars.
So you have
$$T_\text{dilated on Earth}=\sqrt{1−\frac{2Gm_\text{Earth}}{R_\text{Earth}c^2}}\cdot T_\text{without gravity}$$
and
$$T_\text{dilated on Mars}=\sqrt{1−\frac{2Gm_\text{Mars}}{R_\text{Mars}c^2}}\cdot T_\text{without gravity}$$

I also don't understand precisely how it works or which units to do it in to get the correct answer.

When you look up the value for $G$ you usually find
a number with units $\frac{\text{m}^3}{\text{kg}\cdot\text{s}^2}$.
You can use any units for $G$, $m$, $R$ and $c$.
When calculating $\frac{2Gm}{Rc^2}$ you need to consider not only
their numbers but also their units.
A: To compare the time dilation between Mars and Earth you need to use your time dilation equation twice.
$T_\text{without gravity}$ is the time recorded on a clock in effectively empty space, far from any mass.
One way to approach the problem would be to pick a $T_\text{without gravity}$, and then based on that you can calculate how much time passes on each planet
$$T_\text{planet}=\sqrt{1−\frac{2G M_\text{planet}}{R_\text{planet}c^2}}\cdot T_\text{without gravity},$$
where $M_\text{planet}$ is the mass of that planet and $R_\text{planet}$ is the radius of the planet.
A second approach could be to pick a $T_\text{Earth}$.
Then you can solve for $T_\text{without gravity}$.
You can then use your answer for $T_\text{without gravity}$ to solve for $T_\text{Mars}$.
If you like practicing algebra, you could even write down the equation twice, once for Mars and once for Earth.  Then you can eliminate the nuisance variable, $T_\text{without gravity}$, to get a single equation that directly relates $T_\text{Earth}$ to $T_\text{Mars}$ based on the masses and radii of the two.
It doesn't matter what units you use, as long as they are consistent. For example when you look up the gravitational constant $G$ and the speed of light $c$, they probably have units of $\frac{\text{m}^3}{\text{kg}\cdot \text{s}^2}$ and m/s, respectively.  This means you should use the planet mass in kilograms.  That way the numerator of the fraction in the equation will have units of $\frac{\text{m}^3}{\text{s}^2}$ after the kg in the mass cancels the kg in $G$.  In the denominator you should use the planet radius in meters.  That way the units of the denominator will completely cancel the units of the numerator.
A: The time dilation relative to an observer at infinity is
$\rm \dot{t}=\gamma \ \surd g^{tt}  = 1/\surd[(1-v^2/c^2)(1-r_s/r)(1-R_s/R)]$
where $\rm r_s$ and $\rm r$ are the Schwarzschild and surface radii of the planet, $\rm R_s$ and $\rm R$ the Schwarzschild radius of the sun and the orbital radius of the planet and $\rm v$ the orbital velocity of the planet.
So you divide Earth's $\rm \dot{t}$ by that of Mars to get the relative time dilation between the two: for the Earth we have
$\rm r_s=0.0088 \ m, \ r=6371000 \ m, \ R=1.5e11 \ m, \ v=29780 \ m/s$
and for Mars
$\rm r_s=0.00095 \ m, \ r=3396200 \ m, \ R=2.28e11 \ m, \ v=24070 \ m/s$
with the sun's $\rm R_s=2954 \ m$. That gives us
$\rm \dot{t}_{E}=1.0000000154711$ and $\rm \dot{t}_{M}=1.0000000098411$
for Earth and Mars, so we get
$\rm \dot{t}_{E}/\dot{t}_{M}=1.00000000563$
which is the factor by which the clocks on earth run slower than those on Mars (assuming the clocks on the poles so we can neglect the angle dependend rotation speeds of the planets themselves, and assuming a moment where Jupiter has the same distance to both planets so we can neglect his variable influence too. We could also introduce a 4th term in the denominator where the effects of the planets on each other are also considered by plugging in their distance to each other, but since that varies during the orbit and the effect is too small to make a noticeable difference in this scenario we don't need to overcomplicate it).
I just googled the mass, distance, radius and velocity of the planets and rounded some numbers, so for a higher precision in the solution use a higher precision in the input.
