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.now(); long o = dateTime.until(ZonedDateTime.now(), ChronoUnit.YEARS); System.out.println(o);// w w w. j a va 2 s . co m }
From source file:Main.java
public static void main(String[] args) { ZonedDateTime dateTime = ZonedDateTime.now(); ZonedDateTime n = dateTime.minus(12, ChronoUnit.DAYS); System.out.println(n);/*from www. j av a 2s.c o m*/ }
From source file:Main.java
public static void main(String[] args) { ZonedDateTime dateTime = ZonedDateTime.now(); ZonedDateTime n = dateTime.plus(12, ChronoUnit.YEARS); System.out.println(n);/* w w w.j a v a 2s.co m*/ }
From source file:Main.java
public static void main(String[] args) { ZonedDateTime dateTime = ZonedDateTime.now(); System.out.println(dateTime.getLong(ChronoField.DAY_OF_YEAR)); }
From source file:Main.java
public static void main(String[] args) { ZonedDateTime dateTime = ZonedDateTime.now(); System.out.println(dateTime.get(ChronoField.YEAR)); }
From source file:Main.java
public static void main(String[] args) { ZonedDateTime dateTime = ZonedDateTime.now(); dateTime = dateTime.with(ChronoField.YEAR, 2000); System.out.println(dateTime); }
From source file:Main.java
public static void main(String[] args) { ZonedDateTime dateTime = ZonedDateTime.now(); System.out.println(dateTime.isSupported(ChronoField.YEAR)); }
From source file:Main.java
public static void main(String[] args) { LocalDateTime a = LocalDateTime.from(ZonedDateTime.now()); System.out.println(a); }
From source file:Main.java
public static void main(String[] args) { ZonedDateTime dateTime = ZonedDateTime.now(); dateTime = dateTime.with(TemporalAdjusters.firstDayOfMonth()); System.out.println(dateTime); }
From source file:Main.java
public static void main(String[] args) { OffsetDateTime o = OffsetDateTime.from(ZonedDateTime.now()); System.out.println(o); }