I have a function, which is written in JavaScript for getting the date time in day/month/year hours/minutes/seconds AM/PM format. What I want is a function, which will allow me to return the string of the following type (1 second, or 5 seconds, or 2 minutes, or 4 hours, or 1 day, or 5 months, or 5 years). Here is a sample code snippet:
function (var inputDate)
{
var difference = dateNow - inputDate;
//1 second, or 5 seconds, or 2 minutes, or 4 hours, or 1 day, or 5 months, or 5 years - I want to return the highest difference between both dates (current date and the date, which I input)
return string difference;
}
Thanks in advance!