Say I have something like this:
var time01 = new Date();
var time02 = new Date(2015, 0, 0, 0, 0, 0);
var time03 = new Date(2022, 0, 0, 0, 0, 0);
If I want to calculate the time passed from time02
till today, and how much time remained till the time03
from now, I should do this:
var passed01 = time01.getTime() - time02.getTime();
var passed02 = time03.getTime() - time01.getTime();
And then, I want to make it readable, and I do:
var readable01 = new Date(passed01);
var readable02 = new Date(passed02);
But it gives me a year of some ~1970... How can I get an output of something like: "3 years" or "3 year and 15 days and 17 minutes and 23 seconds" or something similar to that?