JAVA按时间段查询时String型结束时间增加加一天
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
public class test3 {
public static void main(String[] args) {
String d = "2004-1-1";
DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Date dd;
try {
dd = format.parse(d);
Calendar calendar = Calendar.getInstance();
calendar.setTime(dd);
calendar.add(Calendar.DAY_OF_MONTH, 1);
System.out.println(format.format(calendar.getTime()));
} catch (ParseException e) {
e.printStackTrace();
}
}
}