I have a date String:
Thu, 15 Jan 2015, 9:56 AM
I convert it into a date variable:
Thu Jan 15 09:56:00 GMT+05:30 2015
using:
String pattern = "EEE, d MMM yyyy, hh:mm a";
try {
date = new SimpleDateFormat(pattern).parse(getPref("refresh", getApplicationContext()));
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Now I have the following function and pass the date variable to this below function:
public static int getDiffHour(Date first) {
int hoursBetween = Hours.hoursBetween(new LocalDate(first), new LocalDate()).getHours();
return hoursBetween;
}
Which always returns 0. What is the possible cause?