Returns a copy of this LocalDateTime with the specified number of nanoseconds added.
package com.logicbig.example.localdatetime;
import java.time.LocalDateTime;
import java.time.Month;
public class PlusNanosExample {
public static void main (String... args) {
LocalDateTime d = LocalDateTime.of(2016, Month.APRIL, 1,
22, 20, 30, 500000);
LocalDateTime d2 = d.plusNanos(100000);
System.out.println(d2);
d2 = d.plusNanos(-100000);
System.out.println(d2);
}
}
Output
2016-04-01T22:20:30.000600
2016-04-01T22:20:30.000400