# Difference between dates in timestamp format in JavaScript

The timestamp format is designed to find the difference between dates. For example, let's get the difference in milliseconds between the current and the given point in time:

`let now = new Date(); let date = new Date(2015, 11, 4, 23, 59, 59); let diff = now.getTime() - date.getTime(); console.log(diff);`

Obviously, most often we need a difference not in milliseconds, but in days or years. To do this, you just need to convert milliseconds to the value we need.

For example, to convert milliseconds to seconds, you need to divide milliseconds by `1000`, to convert seconds to minutes, you need to divide seconds by `60`, and so on.

Let's, for example, translate the difference between dates into minutes:

`console.log(diff / (1000 * 60));`

And now into hours:

`console.log(diff / (1000 * 60 * 60));`

Print the number of days between March `1`, `1988` and January `10`, `2000`.

Display the number of months elapsed between your birth and the current time.

← →
↑
en ru