List of usage examples for java.time ZonedDateTime withZoneSameLocal
@Override
public ZonedDateTime withZoneSameLocal(ZoneId zone)
From source file:Main.java
public static void main(String[] args) { ZonedDateTime dateTime = ZonedDateTime.now(); ZonedDateTime l = dateTime.withZoneSameLocal(ZoneId.systemDefault()); System.out.println(l);/* ww w .j av a 2 s .co m*/ }
From source file:Main.java
public static void main(String[] args) { LocalDateTime localDateTime = LocalDateTime.of(1982, Month.APRIL, 17, 14, 11); ZonedDateTime jakartaTime = ZonedDateTime.of(localDateTime, ZoneId.of("Asia/Jakarta")); System.out.println(jakartaTime); //1982-04-17T14:11+07:00[Asia/Jakarta] System.out.println(jakartaTime.withZoneSameInstant(ZoneId.of("America/Los_Angeles"))); //1982-04-16T23:11-08:00[America/Los_Angeles] System.out.println(jakartaTime.withZoneSameLocal(ZoneId.of("America/New_York"))); //1982-04-17T14:11-05:00[America/New_York] }