I'm creating app. It's a news list where on every news I need to show date, e.g. 9 hours ago or 1 month ago and so on. Also I have future news, so I need also to show e.g. after 1 month. So I'm using DateUtils.getRelativeTimeSpanString()
for this purpose. But I only can show past dates, e.g. 9 hours ago or 1 month ago and I can't show future dates. It shows the future date like Jun 26, 2020. So is there a way to show it e.g. after 2 month using DateUtils
?
DateUtils.getRelativeTimeSpanString(
millis,
System.currentTimeMillis(),
DateUtils.MINUTE_IN_MILLIS).toString();