Client based language javascript’s Date Time Difference Example.

// getDateTime use to get current date and time
function getDateTime() {
// get current date
var now = new Date();
var year = now.getFullYear();
var month = now.getMonth() + 1;
var day = now.getDate();
var hour = now.getHours();
var minute = now.getMinutes();
var second = now.getSeconds();
var milisecond = now.getMilliseconds();
if (month.toString().length == 1) {
var month = '0' + month;
}
if (day.toString().length == 1) {
var day = '0' + day;
}
if (hour.toString().length == 1) {
var hour = '0' + hour;
}
if (minute.toString().length == 1) {
var minute = '0' + minute;
}
if (second.toString().length == 1) {
var second = '0' + second;
}
if (milisecond.toString().length == 1) {
var milisecond = '0' + milisecond;
}
// create date time string
var dateTime = year + "-" + month + "-" + day + "T" + hour + ":" + minute + ":" + second + "." + milisecond;
return dateTime;
}
// get time difference between two time
// argument: dateTime is your means require time
function dateTimeDifference (dateTime) {
var date_current = new Date(getDateTime()); //get current Date and time;
var date_user = new Date(dateTime);
var seconds = Math.floor((date_current - (date_user)) / 1000);
var minutes = Math.floor(seconds / 60);
var hours = Math.floor(minutes / 60);
var days = Math.floor(hours / 24);
var months = Math.floor(days / 30);
var year = Math.floor(days / 365);
// get hours
hours = hours - (days * 24);
// get minutes
minutes = minutes - (days * 24 * 60) - (hours * 60);
// get seconds
seconds = seconds - (days * 24 * 60 * 60) - (hours * 60 * 60) - (minutes * 60);
if (year > 0)
return year + " years ago"; // return years;
if (days > 0)
return days + " days ago"; // return hours;
if (hours > 0)
return hours + " hours ago"; // return hours;
if (minutes > 0)
return minutes + " minutes ago"; // + return minutes;
}
document.write(dateTimeDifference("2015-05-25 11:36:18.083"))
// return"60 Days ago"

Run the code