Example usage for java.time OffsetDateTime with

List of usage examples for java.time OffsetDateTime with

Introduction

In this page you can find the example usage for java.time OffsetDateTime with.

Prototype

@Override
public OffsetDateTime with(TemporalAdjuster adjuster) 

Source Link

Document

Returns an adjusted copy of this date-time.

Usage

From source file:Main.java

public static void main(String[] args) {
    OffsetDateTime o = OffsetDateTime.now();
    OffsetDateTime d = o.with(LocalDate.now());
    System.out.println(d);//from  ww  w .j a  va 2  s  . com
}

From source file:org.silverpeas.core.calendar.Recurrence.java

private OffsetDateTime normalize(final Temporal temporal) {
    OffsetDateTime dateTime = asOffsetDateTime(temporal);
    if (this.startDate != null) {
        return TemporalConverter.applyByType(this.startDate,
                t -> dateTime.with(LocalTime.MIDNIGHT.atOffset(ZoneOffset.UTC)),
                t -> dateTime.with(t.toOffsetTime()));
    }/*from   w w  w . jav a 2  s.  c  o  m*/
    return dateTime;
}