Java tutorial
//package com.java2s; //License from project: Apache License import android.content.Context; import android.text.format.DateUtils; import java.util.Date; public class Main { public static String formatRelativeDate(Context dateContext, Date date) { return DateUtils.getRelativeDateTimeString(dateContext, date.getTime(), DateUtils.MINUTE_IN_MILLIS, DateUtils.DAY_IN_MILLIS * 2, 0).toString(); } }