public static boolean dateCompare(String time){
SimpleDateFormat sdf=new SimpleDateFormat(“yyyy-MM-dd HH:mm:ss”);
try {
long start = sdf.parse(time).getTime();
//获取当前时间毫秒值
long current = System.currentTimeMillis();// 返回一个毫秒数
//判断当前时间大于21分钟
if((current - start)/ 1000 / 60 > 21){
//System.out.println(“大于21min---------------”);
return true;
}
//System.out.println(“小于21min----------------”);
} catch (ParseException e) {
e.printStackTrace();
}
return false;
}



