OffsetDateTime with(TemporalAdjuster adjuster)
returns an adjusted copy of this date-time.
with
has the following syntax.
public OffsetDateTime with(TemporalAdjuster adjuster)
The following example shows how to use with
.
import java.time.LocalDate; import java.time.OffsetDateTime; /*ww w . ja va 2 s.c o m*/ public class Main { public static void main(String[] args) { OffsetDateTime o = OffsetDateTime.now(); OffsetDateTime d = o.with(LocalDate.now()); System.out.println(d); } }
The code above generates the following result.