Currently I am Using DateFormat to convert Current Date, then I get the output like 8/27/12 (month/day/year).
But I want to display like this Today, Yesterday.
How to make this?
Please help me
I tried this:
long dtMili = System.currentTimeMillis();
Date d = new Date(dtMili);
java.text.DateFormat dateFormat = android.text.format.DateFormat.getDateFormat(getApplicationContext());
System.out.println("DATE FORMAT "+ dateFormat.format(d));
Using Dateformat in iPhone:
NSString *dateString = [self getNaturalDay:CurrentDate];
This will help you:
Edit:
Try to run this code. It will display “0 minutes ago”,Instead of displaying some date format and depending upon ur logic it will display the time in its realtive form(i.e. 12 hours ago, yesterday, 3 days ago e.t.c.). This way of displaying time is called Relative time display.
Deadlock