How to add days to java.sql.date?

前端 未结 5 2682
猫巷女王i
猫巷女王i 2021-02-20 07:16

Here is my program, I tried

java.sql.Date logicalDate;
Calendar c = Calendar.getInstance(); 
c.setTime(logicalDate); 
c.add(Calendar.DATE, 1);

5条回答
  •  无人及你
    2021-02-20 07:23

    Here is a method

    private Date sqlDatePlusDays(Date date, int days) {
        return Date.valueOf(date.toLocalDate().plusDays(days));
    }
    

提交回复
热议问题