Java tutorial
//package com.java2s; import java.util.Calendar; public class Main { public static String timeAgo(Long timestamp) { Long now = Calendar.getInstance().getTime().getTime(); Long seconds = (now - timestamp) / 1000; String time = " ("; Long day = seconds / 86400; Long hours = (seconds % 86400) / 3600; //Long mins = (seconds % 3600) / 60; //Long sec = seconds % 60; time += day + "d " + hours + "h " + " ago)"; return time; } }