OffsetTime plusSecond() method in Java with Examples Last Updated : 31 Dec, 2018 Comments Improve Suggest changes Like Article Like Report The plusSeconds() method of OffsetTime class is used to add specified number of seconds value to this OffsetTime and return the result as a OffsetTime object. This instant is immutable. The calculation wraps around midnight. Syntax: public OffsetTime plusSeconds(long SecondsToAdd) Parameters: This method accepts a single parameter SecondsToAdd which is the value of Seconds to be added, it can be a negative value. Return value: This method returns a OffsetTime based on this time with the Seconds added. Below programs illustrate the plusSeconds() method: Program 1: Java // Java program to demonstrate // OffsetTime.plusSeconds() method import java.time.*; public class GFG { public static void main(String[] args) { // create a OffsetTime object OffsetTime time = OffsetTime.parse("21:15:10+11:10"); // print OffsetTime System.out.println("OffsetTime before addition: " + time); // add 200 Seconds using plusSeconds() OffsetTime value = time.plusSeconds(200); // print result System.out.println("OffsetTime after addition: " + value); } } Output: OffsetTime before addition: 21:15:10+11:10 OffsetTime after addition: 21:18:30+11:10 Program 2: Java // Java program to demonstrate // OffsetTime.plusSeconds() method import java.time.*; public class GFG { public static void main(String[] args) { // create a OffsetTime object OffsetTime time = OffsetTime.parse("14:25:10+01:10"); // print OffsetTime System.out.println("OffsetTime before addition: " + time); // add -3400 Seconds using plusSeconds() OffsetTime value = time.plusSeconds(-3400); // print result System.out.println("OffsetTime after addition: " + value); } } Output: OffsetTime before addition: 14:25:10+01:10 OffsetTime after addition: 13:28:30+01:10 References: https://docs.oracle.com/javase/8/docs/api/java/time/OffsetTime.html#plusSeconds-long- Comment More infoAdvertise with us Next Article OffsetTime plusSecond() method in Java with Examples gopaldave Follow Improve Article Tags : Java Java-Functions Java-time package Java-OffsetTime Practice Tags : Java Similar Reads OffsetDateTime plusSeconds() method in Java with examples The plusSeconds() method of OffsetDateTime class in Java returns a copy of this OffsetDateTime with the specified number of seconds added to the parsed date and time. Syntax: public OffsetDateTime plusSeconds(long seconds) Parameter: This method accepts a single parameter seconds which specifies the 2 min read OffsetTime plus() method in Java with examples In OffsetTime class, there are two types of plus() method depending upon the parameters passed to it. plus(long amountToAdd, TemporalUnit unit) plus() method of a OffsetTime class used to return a copy of this OffsetTime with the specified amount of unit added.If it is not possible to add the amount 2 min read OffsetTime plusNanos() method in Java with Examples The plusNanos() method of OffsetTime class used to add specified no of nanoseconds value to this OffsetTime and return the result as a OffsetTime object. This instant is immutable. The calculation wraps around midnight. Syntax: public OffsetTime plusNanos(long nanosecondsToAdd) Parameters: This meth 2 min read OffsetTime plusHours() method in Java with examples The plusHours() method of OffsetTime class is used to add specified no of Hours value to this OffsetTime and return the result as a OffsetTime object. This instant is immutable. The calculation wraps around midnight. Syntax: public OffsetTime plusHours(long hoursToAdd) Parameters: This method accept 2 min read OffsetTime plusMinutes() method in Java with examples The plusMinutes() method of OffsetTime class is used to add specified number of Minutes value to this OffsetTime and return the result as a OffsetTime object. This instant is immutable. The calculation wraps around midnight. Syntax: public OffsetTime plusMinutes(long MinutesToAdd) Parameters: This m 2 min read OffsetTime until() Method in Java with Examples until() method of the OffsetTime class used to calculate the amount of time between two OffsetTime objects using TemporalUnit. The start and end points are this and the specified OffsetTime passed as a parameter. The result will be negative if the end is before the start. The calculation returns a w 2 min read OffsetDateTime plusDays() method in Java with examples The plusDays() method of OffsetDateTime class in Java returns a copy of this OffsetDateTime with the specified number of days added to the parsed date and time. Syntax: public OffsetDateTime plusDays(long days) Parameter: This method accepts a single parameter days which specifies the days to be add 2 min read OffsetTime query() method in Java with examples The Query() method of OffsetTime class in Java queries this time using the specified query. Syntax : public R query(TemporalQuery query) Parameter: This method accepts a single parameter query that specifies the query to be invoked and not null. Return Value: It returns the query result, null may be 1 min read OffsetDateTime plusMonths() method in Java with examples The plusMonths() method of OffsetDateTime class in Java returns a copy of this OffsetDateTime with the specified number of months added to the parsed date and time. Syntax: public OffsetDateTime plusMonths(long months) Parameter: This method accepts a single parameter months which specifies the mont 2 min read OffsetDateTime plusNanos() method in Java with examples The plusNanos() method of OffsetDateTime class in Java returns a copy of this OffsetDateTime with the specified number of nanoseconds added to the parsed date and time. Syntax: public OffsetDateTime plusNanos(long nanoseconds) Parameter: This method accepts a single parameter nanoseconds which speci 2 min read Like