Add gradle to build.gradle
implementation 'si.virag:fuzzydateformatter:1.1.0'
Converting date to string
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
Date date = new Date();
String dateTime = dateFormat.format(date);
Converting string to date
String dtStart = "2019-03-15T09:27:37Z";
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
try {
date = format.parse(dtStart);
System.out.println(date);
String text = FuzzyDateTimeFormatter.getTimeAgo(MainActivity.this, date);
} catch (ParseException e) {
e.printStackTrace();
}