Example usage for java.time OffsetDateTime toLocalDateTime

List of usage examples for java.time OffsetDateTime toLocalDateTime

Introduction

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

Prototype

public LocalDateTime toLocalDateTime() 

Source Link

Document

Gets the LocalDateTime part of this date-time.

Usage

From source file:Main.java

public static void main(String[] args) {
    OffsetDateTime o = OffsetDateTime.now();
    LocalDateTime l = o.toLocalDateTime();
    System.out.println(l);/*from   w w  w  .  j  av a 2s .  co m*/
}

From source file:org.openmhealth.schema.serializer.Rfc3339OffsetDateTimeSerializer.java

@Override
public void serialize(OffsetDateTime instant, JsonGenerator generator, SerializerProvider provider)
        throws IOException {

    StringBuilder builder = new StringBuilder();

    builder.append(instant.toLocalDateTime().toString());

    if (instant.getSecond() == 0 && instant.getNano() == 0) {
        builder.append(":00");
    }//from w  w w.jav  a 2 s  .  c o  m

    builder.append(instant.getOffset().toString());

    generator.writeString(builder.toString());
}