The user needs to select any date (Userdate). I need to set another jdate one day behind this date (needdate). Can you help with this?
Date date1 = (Userdate.getDate(),-1);
needdate.setDate(date1)
The user needs to select any date (Userdate). I need to set another jdate one day behind this date (needdate). Can you help with this?
Date date1 = (Userdate.getDate(),-1);
needdate.setDate(date1)
Copyright © 2021 Jogjafile Inc.
The reason why everyone is telling you to use the new java.time package classes like LocalDate and LocalDateTime etc is because Date is quite old and known to be error prone. But hey...if you're bent on using Date then I suppose you can do it this way:
The
oneDayFromSelectedDateis the Date object containing the JDateChooser selected date less one day. Do consider changing to the java.time package.