OffsetTime minusNanos() method in Java with examples
The minusNanos() method of OffsetTime class in Java returns a copy of this OffsetTime with the specified Nanos in the parameter getting subtracted.
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.
public OffsetTime minusNanos(long Nanos)
Parameter: This method accepts a single parameter Nanos which the Nanos to be subtracted. It may be negative.
Return Value: It returns a OffsetTime based on this time with the Nanos subtracted and it is not null.
Below programs illustrate the minusNanos() method:
Program 1 :
After subtraction, time is: 11:10:09.999999995+05:05
Program 2 :
After subtraction, time is: 11:10:10.000000005+05:05