OffsetTime with(TemporalAdjuster adjuster) example

Description

OffsetTime with(TemporalAdjuster adjuster) returns an adjusted copy of this time.

Syntax

with has the following syntax.


public OffsetTime with(TemporalAdjuster adjuster)

Example

The following example shows how to use with.


import java.time.OffsetTime;
/*  w  ww . ja v  a  2s  .com*/
public class Main {
  public static void main(String[] args) {
    OffsetTime m = OffsetTime.now();
    OffsetTime n = m.with(OffsetTime.now());
    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