I want to change data in my code, I used ‘java.time.LocalDateTime’ and ‘java.util.Date’, but I don’t know how to change data for next event, for exemple I have a String ‘2022-08-20 20:21:00’, and I would like to add 24 hours for next event. How can I add those hours? Thanks 😀
public String nextEvent(String currentTime) {
LocalDateTime nextEv = LocalDateTime.parse(currentTime).plusHours(numberOfHours);
return nextEv.toString();
}
Njr is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.