3

I mite be asking a simple question here, but please take it easy on me. OK... I have a TextView that displays my notes created date - that's working all fine, but how do I convert the time stamp into "7 min ago", "yesterday", "3 weeks ago", "2 months ago" etc.

// joda-time
final String timeFormat = "HH:mm"; ///'o''clock'
final String dateFormat = "EEE, MMM.DD YYYY"; ///EEE MMM dd yyyy
final DateTime createTime = note.getCreateTime();

final String createdString = createTime.toLocalDate().toString(dateFormat) + " " + createTime.toLocalTime().toString(timeFormat);
String timestamp = StringUtils.wrapWithEmptyLines(getString(R.string.note_list_timestamp_info_created,createdString));


final TextView textTS = (TextView) view.findViewById(R.id.timestamp);
textTS.setText(timestamp);
Jaymin Panchal
  • 2,797
  • 2
  • 27
  • 31
saltais
  • 135
  • 2
  • 9
  • 4
    possible duplicate of [How to calculate elapsed time from now with Joda-Time?](http://stackoverflow.com/questions/2179644/how-to-calculate-elapsed-time-from-now-with-joda-time) – Jorge Campos Jan 18 '15 at 14:34

0 Answers0