DateUtils.getRelativeTimeSpanString for future dates

前端 未结 3 1965
北荒
北荒 2021-01-14 14:28

So [DateUtils.getRelativeTimeSpanString()][1] in the Android SDK works great for showing relative times that are in the past.

i.e: 5 days ago, or 5 minutes ago.

3条回答
  •  春和景丽
    2021-01-14 15:13

    DateUtils.getRelativeTimeSpanString(endDate.getTime(), startDate.getTime(), DateUtils.FORMAT_ABBREV_RELATIVE);
    

    With the following caveat:

    Gives tomorrow instead of in 1 day.

提交回复
热议问题