//The First Code
/*private String getDisplayTime(String datetime) {
try {
Date dt = sdf.parse(datetime);
if (now.getYear()==dt.getYear() && now.getMonth()==dt.getMonth() && now.getDate()==dt.getDate()) {
return df[1].format(dt);
}
return df[0].format(dt);
} catch (ParseException e) {
return datetime;
}
}*/
//The second code
private String getDisplayTime(String dateTime) {
try {
//Date dt = sdf.parse(dateTime);
Calendar cal = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
sdf.setCalendar(cal);
sdf.parse(dateTime);
if ( cal1.get(cal1.YEAR)==cal.get(cal.YEAR) && cal1.get(cal1.MONTH)==cal.get(cal.MONTH) && cal1.get(cal1.DATE)==cal.get(cal.DATE)) {
return df[1].format(cal); }
} catch (ParseException e) {
}
return dateTime;
}
The Code above are two, but the first is the real one. But, the format has been deprecated so I can't use it. So, I did the second to test it, but I'm not getting the output I needed...Please Help me Out. Thank You.