The
minusHours() method of OffsetTime class in Java returns a copy of this OffsetTime with the specified hours in the parameter getting subtracted.
Syntax :
public OffsetTime minusHours(long hours)
Parameter: This method accepts a single parameter
hours which the hours to be subtracted. It may be negative.
Return Value: It returns a OffsetTime based on this time with the hours subtracted and it is not null.
Below programs illustrate the minusHours() method:
Program 1 :
Output:
After subtraction, time is: 06:10:10+05:05
Program 2 :