Example usage for java.time OffsetDateTime withOffsetSameLocal

List of usage examples for java.time OffsetDateTime withOffsetSameLocal

Introduction

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

Prototype

public OffsetDateTime withOffsetSameLocal(ZoneOffset offset) 

Source Link

Document

Returns a copy of this OffsetDateTime with the specified offset ensuring that the result has the same local date-time.

Usage

From source file:Main.java

public static void main(String[] args) {
    OffsetDateTime o = OffsetDateTime.now();
    OffsetDateTime l = o.withOffsetSameLocal(ZoneOffset.UTC);
    System.out.println(l);/*from  w ww .  ja va 2s  .  c  o m*/
}