Suppose I wanted to travel to one of the recently discovered potentially Earth-like planets such as Kepler 186f that is 490 light years away. Assuming I had a powerful rocket and enough fuel, how long would it take me?
Start by considering what is seen by the people watching you from the Earth. Nothing can travel faster than the speed of light, $c$, so the quickest you could get to Kepler 186f would be if you were travelling at $c$ in which case it would take 490 years. In practice it would take longer than this because you have to accelerate from rest when you leave the Earth and decelerate to a halt again when you get to your destination. 

So far this isn’t very interesting. What makes the problem interesting is that clocks on fast moving objects run slow due to time dilation. If you could travel near to the speed of light the time that passes for you will be less than 490 years, and in fact can be a lot less, as we’ll see below.

First let’s take the simple case where you travel at some constant velocity $v$, and we won’t worry about how you accelerated to $v$ or how you’re going to slow down again. We’ll call the distance to the star $d$. For the people watching from Earth the time taken is just the distance you travel divided by your velocity:

$$ t = \frac{d}{v} $$

So if the distance is 490 light years and you’re travelling at the speed of light the time taken is just 490 years. But how much time would you measure on your wristwatch? To do the calculation properly you need to use the Lorentz transformations, but in fact the answer turns out to be very simple. The time you measure, $\tau$, is given by:

$$ \tau = \frac{t}{\gamma} $$

where $t$ is the time measured on Earth and $\gamma$ is the Lorentz factor and is given by:

$$ \gamma = \frac{1}{\sqrt{1 - \tfrac{v^2}{c^2}}} $$

Or if you want the whole expression written out in full, the time you measure is:

$$ \tau = \frac{d}{v} \sqrt{1 - \frac{v^2}{c^2}} $$

To give you a feel for this I’ve done the calculation for the 490 light year trip to Kepler 186f and I’ve drawn a graph of the time you measure as a function of your speed:



The blue line is the travel time as measured on Earth, so it goes to 490 years as $v \rightarrow c$. The red line is the time measured on your wristwatch, which goes to zero as $v \rightarrow c$.

But this isn’t very realistic since it ignores acceleration and deceleration. Suppose instead you travel halfway to the star at constant acceleration, then you flip over and travel halfway at constant deceleration. This allows you to start from rest and end at rest, and you also get a nice artificial gravity during the trip. But how can you calculate the time dilation for a trip that involves acceleration?

The details of the calculation are given in Chapter 6 of Gravitation by Misner, Thorne and Wheeler. I won’t reproduce the calculation here because it’s surprisingly boring. You solve a couple of simultaneous equations to get differential equations for the time, $t$, and distance, $x$, and you solve these two differential equations to get:

$$ t = \frac{c}{a} \sinh\left(\frac{a\tau}{c}\right) \tag{1} $$

$$ x = \frac{c^2}{a} \left(\cosh\left(\frac{a\tau}{c} \right) – 1 \right) \tag{2} $$

In these equations $\tau$ is the time measured on your wristwatch, $t$ is the time measured by the observers on Earth and $x$ is the distance travelled as measured by the observers on Earth. The times $t$ and $\tau$ start at zero at the moment you begin accelerating and leave the Earth. Finally $a$ is your constant acceleration. Note that $a$ is the acceleration you measure i.e. it’s the acceleration shown by an accelerometer you hold while you’re sat in the rocket.

To do the calculation, for example for the trip to Kepler 186f, you take the first half of the journey while the rocket is accelerating and set $x$ to this distance. So for Kepler 186f $x = 245$ light years. Then you solve equation (2) to get the elapsed time on the rocket $\tau$, and finally plug this into equation (1) to get the elapsed time on Earth. This is the time for half the trip, so just double it to get the time for the whole trip. I’ve done this for a range of accelerations to get this graph:



Again the blue line is the time measured on Earth and the red line is your time. At an acceleration of only 0.1g the travel time is already down to 76 years (just doable in a  single lifetime) and at a more comfortable 1g the travel time is a shade over 12 years.

Since the values aren't that easy to read off the graph here are some representative values:

$$\begin{matrix}
    a (/g) & \tau (/\text{years}) & t (/\text{years}) \\
   0.01 & 374.9 & 655.9 \\
   0.1 & 76.8 & 509.0 \\
   1 & 12.1 & 491.9 \\
   10 & 1.7 & 490.2
\end{matrix}$$

Footnotes for non-non-nerds

Assuming you have more than a casual interest in Physics (why else would you be reading this!) there is lots more interesting stuff about accelerated motion. For example you might wonder how the spaceship accelerating at 1g can travel 490 light years in 12.1 years if nothing can travel faster than light. The answer is that the spaceship doesn’t travel 490 light years - the Lorentz contraction caused by its high speed means it travels a much shorter distance.

We’ve got the equations for distance and time above, and you can combine them to work out the velocity as a function of spaceship time $\tau$. I won’t do this since it’s just algebra; instead I’ll just quote the result:

$$ v = c \tanh \left( \frac{a\tau}{c} \right) \tag{3} $$

If the spaceship is travelling at velocity $v$ relative to the Earth and destination star then the Earth and star are travelling at velocity $v$ relative to the spaceship, and the crew of the spaceship see distances contracted by the Lorentz factor:

$$ d’ = \frac{d}{\gamma} = d\sqrt{1 - \frac{v^2}{c^2}} $$

When the spaceship sets off its distance to the star is 490 light years, but as it accelerates this distance decreases for two reasons. Firstly (obviously) the ship moves towards the star, but secondly Lorentz contraction makes the remaining distance smaller.

To calculate this effect you work out $x(\tau)$ using equation (2) for the first half of the trip. Since the trip is symmetrical you can reflect about the halfway point to get $x(\tau)$ for the second half of the journey. Then the distance left is just (for Kepler 186f) 490 light years - $x$. Calculate the velocity using equation (3) (again for the first half then reflect about the halfway point). Calculate the Lorentz factor from the velocity and multiply to get the contracted distance left. The results for 1g acceleration look like this:



To make the data clearer I’ve plotted the remaining distance for the last half of the trip on an expanded scale to the right. The discontinuity is where the spaceship switches from acceleration to deceleration. The graph shows that the occupants of the ship see the distance they have left to travel shrink rapidly as their speed increases. Conversely, as they start decelerating the Lorentz contraction decreases and the distance left to travel decreases only slowly until they are close to the destination.
