当前位置:网站首页>Date的after时间判断

Date的after时间判断

2022-04-23 14:08:00 阿闰

	        Date nd=new Date();
		 
			Date goServiceTime=DateUtil.stringToDate("2021-09-18"+" "+"16:00", DateUtil.DATE_TIME_FORMAT_TIME);//上门服务时间
			Date dayend=DateUtil.additionDate(nd, 24);//+24
			//当前时间+24》上门服务时间  则不能退
			if(dayend.after(goServiceTime)) {
				//after >     before <
				System.out.println("不能退");
			}



public static Date stringToDate(String datestr, String dateformat) {
        Date date = new Date();
        SimpleDateFormat df = new SimpleDateFormat(dateformat);
        try {
            date = df.parse(datestr);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return date;
    }

 after >  

  before <

版权声明
本文为[阿闰]所创,转载请带上原文链接,感谢
https://blog.csdn.net/wasd986523/article/details/120350015