TimeUtils.java
488 Bytes
package com.bsth.util;
public class TimeUtils {
public static String getTimeDifference(String date1,String date2){
String[] temp1 = date1.split(":");
String[] temp2 = date2.split(":");
int m1 = Integer.parseInt(temp1[0])*60;
int s1 = Integer.parseInt(temp1[1]);
int m2 = Integer.parseInt(temp2[0])*60;
int s2 = Integer.parseInt(temp2[1]);
if(date1.compareTo(date2) > 0){
return ((m1+s1)-(m2+s2))+"";
} else {
return ((m2+s2)-(m1+s1))+"";
}
}
}