List of usage examples for java.time ZonedDateTime now
public static ZonedDateTime now()
From source file:Main.java
public static void main(String[] args) { ZonedDateTime dateTime = ZonedDateTime.from(ZonedDateTime.now()); String s = dateTime.format(DateTimeFormatter.ISO_DATE_TIME); System.out.println(s);//from w w w . j a v a 2 s. co m }
From source file:Main.java
public static void main(String[] args) { ZonedDateTime dateTime = ZonedDateTime.now(); LocalDate o = dateTime.query(TemporalQueries.localDate()); System.out.println(o);/*from ww w . j ava2 s . c o m*/ }
From source file:Main.java
public static void main(String[] args) { ZonedDateTime dateTime = ZonedDateTime.now(); ValueRange l = dateTime.range(ChronoField.YEAR); System.out.println(l);/*www . j av a 2 s.co m*/ }
From source file:Main.java
public static void main(String[] args) { ZonedDateTime zdt1 = ZonedDateTime.now(); System.out.println("Current zoned datetime:" + zdt1); LocalDateTime ldt = LocalDateTime.of(2012, Month.MARCH, 11, 7, 30); ZoneId usCentralZone = ZoneId.of("America/Chicago"); ZonedDateTime zdt2 = ZonedDateTime.of(ldt, usCentralZone); System.out.println(zdt2);/*from w ww .j av a 2 s .c om*/ }
From source file:Main.java
public static void main(String[] args) { ZoneOffset z = ZoneOffset.UTC; Temporal t = z.adjustInto(ZonedDateTime.now()); System.out.println(t);// w w 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"); ZonedDateTime l = ZonedDateTime.now(); System.out.println(instant.until(l, ChronoUnit.DAYS)); }
From source file:Main.java
public static void main(String[] args) { Instant instant = Instant.parse("2014-12-03T10:15:30.00Z"); ZonedDateTime l = ZonedDateTime.now(); Temporal t = instant.adjustInto(l); System.out.println((ZonedDateTime) t); }
From source file:Main.java
public static void main(String[] args) { ZoneId offsetOfSixHours = ZoneId.ofOffset("UTC", ZoneOffset.ofHours(-6)); System.out.println(ZonedDateTime.now().withZoneSameInstant(offsetOfSixHours)); }
From source file:Main.java
public static void main(String[] argv) { DateTimeFormatter format = DateTimeFormatter.ofPattern("MMM dd yyyy hh:mm a z"); ZonedDateTime arrivalDate = ZonedDateTime.now(); String landing = arrivalDate.format(format); System.out.printf("Arriving at : %s %n", landing); }
From source file:Main.java
public static void main(String[] args) { DateTimeFormatter obscurePattern = DateTimeFormatter.ofPattern("MMMM dd, yyyy '(In Time Zone: 'VV')'"); ZonedDateTime zonedNow = ZonedDateTime.now(); System.out.println(obscurePattern.format(zonedNow)); }