DateUtils getRelativeTimeSpanString isn't returning time in "X seconds ago"

1.8k views Asked by At

I am using the getRelativeTimeSpanString(...) to get time back in X seconds ago X hours ago etc.

However, when the difference between the two times is short - minutes or seconds, then it is returning in 10 hours instead of X minutes ago

Here is how I'm using it:

Date date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.ENGLISH)
                                .parse("2014-05-21 13:07:11");
Date currentDate = new Date();
CharSequence cs =  DateUtils.getRelativeTimeSpanString(date.getTime(), 
                                 currentDate.getTime(), DateUtils.SECOND_IN_MILLIS);
0

There are 0 answers