I am getting UTC date from db. And subtracting that from current utc DateTime. I would like to have diff. in minutes. Something in not quite right.
Date currenttimedate = DateTime.UTCNow();
String lastsynctime = c.getString(c.getColumnIndex(columnname)).toString();
Date lastruntimedate = DateTime.StringDateToDate(lastsynctime, "MM/dd/yyyy HH:mm:ss");
long diffInMs = (currenttimedate. getTime() - lastruntimedate.getTime());
// convert it to Minutes
long diffInMins = TimeUnit.MILLISECONDS.toMinutes(diffInMs);
// return time in minutes
response = (int)(diffInMins);
It's returning something like 720 minutes. Expected answer can not be more than 5. As data is synced every 5 mins.