Best way to format a date relative to now on Android

前端 未结 10 1840
隐瞒了意图╮
隐瞒了意图╮ 2021-01-31 15:57

I am creating a feature in an Android app to get an arbitrary date (past, present or future) and find the difference relative to now.

Both my now and

10条回答
  •  萌比男神i
    2021-01-31 16:56

    long now = System.currentTimeMillis();

    DateUtils.getRelativeDateTimeString(mContext, now), DateUtils.SECOND_IN_MILLIS, DateUtils.DAY_IN_MILLIS, 0)

    a link!

提交回复
热议问题