Best way to format a date relative to now on Android

前端 未结 10 1708
隐瞒了意图╮
隐瞒了意图╮ 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条回答
  •  北海茫月
    2021-01-31 16:36

    The actual reason is the number 864000 is in miliseconds, which corresponds to 14 minutes. 14 minutes is so small compared to DAY_IN_MILLIS (a day). There for you get "in 0 days". If you want it to produce "in 14 mins", just change DAY_IN_MILLIS to MIN_IN_MILLIS.

提交回复
热议问题