问题很简单,如何为这种日期格式添加天数:
MM / dd / yyyy喜欢11/06/2015答案 0 :(得分:1)
您可以这样做:
String format = "mm/dd/yyyy";
String date = "11/06/2015";
SimpleDateFormat simpleFormat = new SimpleDateFormat("mm/dd/yyyy");
java.text.DateFormat df = new java.text.SimpleDateFormat(format);
java.util.Calendar calendar = java.util.Calendar.getInstance();
try {
calendar.setTime(df.parse(date));
calendar.add(java.util.Calendar.DAY_OF_MONTH, +1);
String formatted = simpleFormat.format(calendar.getTime());
System.out.println(formatted);
} catch (Exception ex) {
System.out.println("Error: " + ex.toString());
}