DateUtils.getRelativeTimeSpanString for future dates

前端 未结 3 1951
北荒
北荒 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:08

    I'd try using DateUtils.getRelativeTimeSpanString(time, now, minResolution) as it works for future dates using an "in n days" format.

    http://developer.android.com/reference/android/text/format/DateUtils.html#getRelativeTimeSpanString

自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题