Example usage for java.time ZoneId systemDefault

List of usage examples for java.time ZoneId systemDefault

Introduction

In this page you can find the example usage for java.time ZoneId systemDefault.

Prototype

public static ZoneId systemDefault() 

Source Link

Document

Gets the system default time-zone.

Usage

From source file:Main.java

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

    System.out.println(z);//from  ww  w.ja va 2s.c  o  m

}

From source file:Main.java

public static void main(String[] args) {
    LocalDateTime a = LocalDateTime.of(2014, 6, 30, 12, 00);
    ZonedDateTime b = a.atZone(ZoneId.systemDefault());

    System.out.println(b);//from   w w w .ja  va  2s .c o  m
}

From source file:Main.java

public static void main(String[] args) {
    ZonedDateTime z = ZonedDateTime.of(LocalDate.now(), LocalTime.now(), ZoneId.systemDefault());

    System.out.println(z);/* w ww . ja  v  a  2 s . c o m*/

}

From source file:Main.java

public static void main(String[] args) {
    OffsetDateTime o = OffsetDateTime.now();
    Temporal d = o.adjustInto(OffsetDateTime.now(ZoneId.systemDefault()));
    System.out.println(d);//from  w  w w.  j  a  va  2  s.  co  m
}

From source file:Main.java

public static void main(String[] args) {
    Date date = new Date();
    LocalDateTime localDateTime = LocalDateTime.ofInstant(date.toInstant(), ZoneId.systemDefault());

    System.out.println(localDateTime);
}

From source file:Main.java

public static void main(String[] args) {
    LocalDateTime now = LocalDateTime.now();
    Instant instant = now.atZone(ZoneId.systemDefault()).toInstant();
    Date dateFromOld = Date.from(instant);

    System.out.println(dateFromOld);
}

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 ww  .  jav a2 s. com*/

}

From source file:Main.java

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

    System.out.println(z);/*from   www.  j  a  va  2 s.  co  m*/

}

From source file:Main.java

public static void main(String[] args) {
    LocalDateTime dtPrevistaBR = LocalDateTime.of(2014, 3, 26, 10, 35);

    ZonedDateTime localOrigemZone = ZonedDateTime.of(dtPrevistaBR, ZoneId.systemDefault());

    ZoneId localEntregaZoneId = ZoneId.of("America/Bogota");
    ZonedDateTime dtPrevista = localOrigemZone.withZoneSameInstant(localEntregaZoneId);

    System.out.println("Data Prevista (Brasileira): " + dtPrevistaBR);
    System.out.println("Data Prevista (Bogota): " + dtPrevista.toLocalDateTime());
}

From source file:Main.java

public static void main(String[] args) {
    Clock defaultClock = Clock.systemDefaultZone();

    Instant instant = Instant.now(defaultClock);

    ZonedDateTime zonedDateTime = ZonedDateTime.ofInstant(instant, ZoneId.systemDefault());

    System.out.println(zonedDateTime);
}