OffsetTime plusHours(long hours) example

Description

OffsetTime plusHours(long hours) returns a copy of this OffsetTime with the specified period in hours added.

Syntax

plusHours has the following syntax.


public OffsetTime plusHours(long hours)

Example

The following example shows how to use plusHours.


import java.time.OffsetTime;
/*from w  ww. j av a 2 s .c o  m*/
public class Main {
  public static void main(String[] args) {
    OffsetTime m = OffsetTime.now();
    OffsetTime n = m.plusHours(34);
    System.out.println(n);

  }
}

The code above generates the following result.





















Home »
  Java Date Time »
    java.time Reference »




Clock
DayOfWeek
Duration
Instant
LocalDate
LocalDateTime
LocalTime
Month
MonthDay
OffsetDateTime
OffsetTime
Period
Year
YearMonth
ZonedDateTime
ZoneId
ZoneOffset