Example usage for java.time ZoneOffset UTC

List of usage examples for java.time ZoneOffset UTC

Introduction

In this page you can find the example usage for java.time ZoneOffset UTC.

Prototype

ZoneOffset UTC

To view the source code for java.time ZoneOffset UTC.

Click Source Link

Document

The time-zone offset for UTC, with an ID of 'Z'.

Usage

From source file:Main.java

public static void main(String[] args) {
    OffsetTime m = OffsetTime.now();
    OffsetTime l = m.withOffsetSameLocal(ZoneOffset.UTC);
    System.out.println(l);/* ww w  . j  ava 2s  .com*/

}

From source file:Main.java

public static void main(String[] args) {
    OffsetTime m = OffsetTime.now();
    OffsetTime l = m.withOffsetSameInstant(ZoneOffset.UTC);
    System.out.println(l);/*from  w w  w .  j  a v  a 2  s  . c  om*/

}

From source file:Main.java

public static void main(String[] args) {
    LocalDateTime a = LocalDateTime.ofInstant(Instant.now(), ZoneOffset.UTC);

    System.out.println(a);
}

From source file:Main.java

public static void main(String[] args) {
    LocalTime l = LocalTime.now();
    OffsetTime t = l.atOffset(ZoneOffset.UTC);
    System.out.println(t);/*from  w ww  .j a v  a  2s  . c  o m*/
}

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);/*  ww  w.java 2 s .com*/
}

From source file:Main.java

public static void main(String[] args) {
    OffsetDateTime o = OffsetDateTime.of(LocalDateTime.now(), ZoneOffset.UTC);

    System.out.println(o);
}

From source file:Main.java

public static void main(String[] args) {
    OffsetDateTime o = OffsetDateTime.now();
    OffsetDateTime l = o.withOffsetSameInstant(ZoneOffset.UTC);
    System.out.println(l);/*from  ww w.  j  a va2  s .c om*/
}

From source file:Main.java

public static void main(String[] args) {
    Instant instant = Instant.parse("2014-12-03T10:15:30.00Z");
    System.out.println(instant.atOffset(ZoneOffset.UTC));

}

From source file:Main.java

public static void main(String[] args) {
    ZonedDateTime z = ZonedDateTime.ofStrict(LocalDateTime.now(), ZoneOffset.UTC, ZoneId.systemDefault());

    System.out.println(z);/* w w  w .j  a  v  a2s .  c  o  m*/

}

From source file:Main.java

public static void main(String[] args) {
    //Getting date from the base date i.e 01/01/1970
    LocalDateTime dateFromBase = LocalDateTime.ofEpochSecond(10000, 0, ZoneOffset.UTC);
    System.out.println("10000th second time from 01/01/1970= " + dateFromBase);
}