求java Date类型字段加一天代码
String startdate=UIDBComboBox1.getValue();
UIDBComboBox1为日期字段下拉框名称 java 类 string
[解决办法]
public static Date getNextDay(Date date)
{
if (date == null)
return null;
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.DAY_OF_MONTH, 1);
return calendar.getTime();
}
[解决办法]
public static void main(String[] args) throws Exception {
String s = "2012-01-31";
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date day = sdf.parse(s);
Calendar c = Calendar.getInstance();
c.setTime(day);
c.add(Calendar.DATE, 1);
System.out.println(sdf.format(c.getTime()));
}