如下:
public static void main(String[] args) throws ParseException {
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date now = sf.parse("2021-08-03 11:10:00");//当前时间
Date date = new Date();//当前时间
long diff = now.getTime() - date.getTime();
long min = diff /60/1000;
//long min = diff / (1000 * 60);
System.out.println(Math.abs(min));
System.out.println(min > 5L);
}