LocalDateTime ldtm = LocalDateTime. of(2014, 3, 30, 12, 30); System. out. println("dateTime created by passing in year, month,day, hour, minute is:"+ldtm.
The plusDays() method of a LocalDate class in Java is used to add the number of specified day in this LocalDate and return a copy of LocalDate. For example, 2018-12-31 plus one day would result in 2019-01-01. This instance is immutable and unaffected by this method call.
If you are using java 8 then you can still use the same syntax
LocalDateTime fiveMinutesLater = LocalDateTime.now().plusMinutes(5)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With