public static boolean compTime(String s1,String s2){
try {
if (s1.indexOf(":")<0||s1.indexOf(":")<0) {
System.out.println("格式不正确");
}else{
String[]array1 = s1.split(":");
int total1 = Integer.valueOf(array1[0])*3600+Integer.valueOf(array1[1])*60+Integer.valueOf(array1[2]);
String[]array2 = s2.split(":");
int total2 = Integer.valueOf(array2[0])*3600+Integer.valueOf(array2[1])*60+Integer.valueOf(array2[2]);
return total1-total2>0?true:false;
}
} catch (NumberFormatException e) {
// TODO Auto-generated catch block
return true;
}
return false;
}
比较两个时分秒时间的大小
猜你喜欢
转载自blog.csdn.net/gaofenglxx/article/details/60140067
今日推荐
周排行