JAVA循环输出近10天的日期

public void countByDate(Timestamp currentMonth){
for(int i =0;i<10;i++){
			if(i==0){
				Timestamp nextMonth=new Timestamp(currentMonth.getTime());
				nextMonth.setHours(23);
				nextMonth.setMinutes(59);
				nextMonth.setSeconds(59);

			}else{
				Timestamp ddd=new Timestamp(currentMonth.getTime());
				currentMonth.setDate(currentMonth.getDate()-1);
				ddd.setDate(currentMonth.getDate());
				ddd.setHours(23);
				ddd.setMinutes(59);
				ddd.setSeconds(59);
				
			}
		}

你可能感兴趣的:(java)