시간차 구하기입니다.
지금 현재 시간을 기준으로 분단위로 얼마나 차이가 나는지를 알려주는 process 랍니다.
public static int getDiffTime(String date) {
SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_FULL_STR);
Calendar cal = Calendar.getInstance(defaultTimeZone);
try {
cal.setTime(sdf.parse(date));
} catch (ParseException e) {
e.printStackTrace();
}
Date today = new Date();
Calendar calToday = Calendar.getInstance(defaultTimeZone);
calToday.setTime(today);
Calendar calInday = Calendar.getInstance(defaultTimeZone);
calInday.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH),
cal.get(Calendar.DATE),cal.get(Calendar.HOUR) , cal.get(Calendar.MINUTE));
int count = 0;
while (!calInday.after(calToday)) {
count++;
calInday.add(Calendar.MINUTE, 1); }
}
return count;
}