Returns a copy of this OffsetTime with the specified number of nanoseconds subtracted, adjusting other fields if necessary.
package com.logicbig.example.offsettime;
import java.time.OffsetTime;
public class MinusNanosExample {
public static void main(String... args) {
OffsetTime t = OffsetTime.now();
System.out.println(t);
OffsetTime t2 = t.minusNanos(1000);
System.out.println(t2);
OffsetTime t3 = t.minusMinutes(Long.MAX_VALUE);
System.out.println(t3);
}
}
Output
16:13:55.900-05:00
16:13:55.899999-05:00
22:06:55.900-05:00
package com.logicbig.example.offsettime;
import java.time.OffsetTime;
public class MinusNanosExample2 {
public static void main(String... args) {
OffsetTime t = OffsetTime.now();
System.out.println(t);
OffsetTime t2 = t.minusNanos(-1000);
System.out.println(t2);
OffsetTime t3 = t.minusMinutes(Long.MIN_VALUE);
System.out.println(t3);
}
}
Output
16:13:58.053-05:00
16:13:58.053001-05:00
10:21:58.053-05:00