Returns a copy of this LocalDateTime with the specified number of nanoseconds subtracted, adjusting other fields if necessary.
package com.logicbig.example.localdatetime;
import java.time.LocalDateTime;
public class MinusNanosExample {
public static void main (String... args) {
LocalDateTime d = LocalDateTime.of(2016, 11, 12,
12, 30, 15);
LocalDateTime d2 = d.minusNanos(1000000);
System.out.println(d2);
d2 = d.minusNanos(-1000000);
System.out.println(d2);
}
}
Output
2016-11-12T12:30:14.999
2016-11-12T12:30:15.001