List of usage examples for java.time Period ofDays
public static Period ofDays(int days)
From source file:Main.java
public static void main(String[] args) { OffsetTime m = OffsetTime.now(); OffsetTime n = m.minus(Period.ofDays(12)); System.out.println(n);//from www. ja v a2s . c o m }
From source file:Main.java
public static void main(String[] args) { LocalDate a = LocalDate.of(2014, 6, 30); LocalDate b = a.plus(Period.ofDays(100)); System.out.println(b);//from w ww.j a v a 2s. c om }
From source file:Main.java
public static void main(String[] args) { LocalDate a = LocalDate.of(2014, 6, 30); LocalDate b = a.minus(Period.ofDays(100)); System.out.println(b);//from ww w .jav a2 s . co m }
From source file:Main.java
public static void main(String[] args) { OffsetDateTime o = OffsetDateTime.now(); OffsetDateTime d = o.plus(Period.ofDays(2)); System.out.println(d);/* w ww .j a va2 s .c o m*/ }
From source file:Main.java
public static void main(String[] args) { ZonedDateTime dateTime = ZonedDateTime.now(); ZonedDateTime n = dateTime.minus(Period.ofDays(12)); System.out.println(n);//from ww w .j a v a 2 s.c om }
From source file:Main.java
public static void main(String[] args) { LocalDateTime a = LocalDateTime.of(2014, 6, 30, 12, 00); LocalDateTime t = a.plus(Period.ofDays(100)); System.out.println(t);// w w w .j av a 2 s.c o m }
From source file:Main.java
public static void main(String[] args) { LocalDateTime a = LocalDateTime.of(2014, 6, 30, 12, 00); LocalDateTime t = a.minus(Period.ofDays(100)); System.out.println(t);//from w w w .j a va2 s . co m }
From source file:Main.java
public static void main(String[] args) { ZoneId usCentral = ZoneId.of("America/Chicago"); LocalDateTime ldt = LocalDateTime.of(2012, Month.MARCH, 10, 7, 30); ZonedDateTime zdt1 = ZonedDateTime.of(ldt, usCentral); Period p1 = Period.ofDays(1); ZonedDateTime zdt2 = zdt1.plus(p1); System.out.println(zdt2);/*from ww w . j a v a2 s . c om*/ }
From source file:Main.java
public static void main(String[] args) { TemporalAdjuster temporalAdjuster = (Temporal t) -> t.plus(Period.ofDays(10)); System.out.println(temporalAdjuster); TemporalAdjuster fourMinutesFromNow = temporal -> temporal.plus(4, ChronoUnit.MINUTES); LocalTime localTime1 = LocalTime.of(12, 0, 0); System.out.println(localTime1.with(temporal -> temporal.plus(4, ChronoUnit.MINUTES))); System.out.println(Instant.now().with(temporalAdjuster)); LocalDate localDate1 = LocalDate.of(2013, 12, 13); System.out.println(localDate1.with(TemporalAdjusters.lastDayOfMonth())); }
From source file:Main.java
public static void main(String[] args) { LocalDate localDate = LocalDate.of(2012, 11, 23); System.out.println(localDate.plus(3, ChronoUnit.DAYS)); //2012-11-26 System.out.println(localDate.plus(Period.ofDays(3))); //2012-11-26 try {/*from ww w . j a v a 2s .c om*/ System.out.println(localDate.plus(Duration.ofDays(3))); System.out.println(localDate.plus(4, ChronoUnit.FOREVER)); } catch (UnsupportedTemporalTypeException e) { e.printStackTrace(); } }