DateUtils.getRelativeDateTimeString的格式化 [英] Formatting of DateUtils.getRelativeDateTimeString

查看:861
本文介绍了DateUtils.getRelativeDateTimeString的格式化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有code这样的

DateUtils.getRelativeDateTimeString(context, due, DateUtils.MINUTE_IN_MILLIS, DateUtils.WEEK_IN_MILLIS,0)

这是格式化输出像

which is outputting strings formatted like

in 23 hours, 6:18am

我不明白好<一个href=\"http://developer.android.com/reference/android/text/format/DateUtils.html#getRelativeDateTimeString%28android.content.Context,%20long,%20long,%20long,%20int%29\">android文档这种方法。

有一个内置的方式来剥离时间或改变逗号更像一句?

Is there a built in way to strip off the time or change the comma to be more sentence like?

任23时间或在上午06时1823小时将是preferable的电流输出。

Either of "in 23 hours" or "in 23 hours at 6:18am" would be preferable to the current output.

感谢。

推荐答案

我用不同的方法,并得到了23时间结果,我想

I have used a different method and gotten the "in 23 hours" result I wanted

DateUtils.getRelativeTimeSpanString(due,now, DateUtils.SECOND_IN_MILLIS)

这篇关于DateUtils.getRelativeDateTimeString的格式化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆