Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I add an int (minutes) to LocalDateTime.now()?

Tags:

java

int

add

People also ask

How do I set LocalDateTime time?

LocalDateTime ldtm = LocalDateTime. of(2014, 3, 30, 12, 30); System. out. println("dateTime created by passing in year, month,day, hour, minute is:"+ldtm.

How do I add something to LocalDate?

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)