Computing the difference between two dates is a very common task (for example, see the Calculating age section). Let's see a collection of other approaches that can be used to obtain the difference between two dates in milliseconds, seconds, hours, and so on.