统计表里面的数据三天和半个月到期的总数

 获取当前时间,最后的时间,转为正确格式,后面转时间戳进行比较,3天和半个月,利用当前时间的时间戳加上多少天的,

一天的时间戳是86400000乘以多少天,然后相加得到

SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	            Date date1;
	            Date date2;
	            Long ts3=null;
	            Long ts1=null;
	            Long ts2=null;
	            String nowtime = CommonUtil.now();
	            if(ss.getEndTime()!=null) {
				try {
					date1 = simpleDateFormat.parse(ss.getEndTime());
					date2 = simpleDateFormat.parse(nowtime);
					 ts1 = date1.getTime();
					 ts2=date2.getTime()+(86400000*15);
					 ts3=date2.getTime()+(86400000*3);
				} catch (ParseException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
				if(ts1<ts2) {
					count1++;
				}
				if(ts1<ts3) {
					count2++;
				}

 

 

posted @ 2022-08-11 18:50  码海兴辰  阅读(27)  评论(0)    收藏  举报