Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Formatting of DateUtils.getRelativeDateTimeString

Tags:

android

I have code like this

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

which is outputting strings formatted like

in 23 hours, 6:18am

I don't understand well the android documentation on this method.

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

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

Thanks.

like image 547
Keith Entzeroth Avatar asked Jan 28 '12 12:01

Keith Entzeroth


1 Answers

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

DateUtils.getRelativeTimeSpanString(due,now, DateUtils.SECOND_IN_MILLIS)
like image 85
Keith Entzeroth Avatar answered Oct 02 '22 03:10

Keith Entzeroth