I have following method that I would like to make shorter or faster if nothing else. Please all comments are welcome:
Bellow method takes a date object, formates i
I know I am late to this party. But I have shortest solution for this problem. If you want to show "Today" or "Yesterday" based on the Date then you just need to use this
String strDate = "";
if (DateUtils.isToday(date.getTime()))
strDate = "Today";
else if (DateUtils.isToday(date.getTime() + DateUtils.DAY_IN_MILLIS))
strDate = "Yesterday";
here variable date is the Date object.