List of usage examples for java.time LocalDate now
public static LocalDate now()
From source file:Main.java
public static void main(String[] args) { System.out.println(toString(LocalDate.now())); }
From source file:Main.java
public static void main(String[] argv) { LocalDate today = LocalDate.now(); LocalDate java8Release = LocalDate.of(2014, Month.MARCH, 14); Period period = Period.between(java8Release, today); System.out.println("Period between today and Java 8 release : " + period); System.out.println("Period between Java 8 release and today : " + Period.between(today, java8Release)); }
From source file:Main.java
public static void main(String[] args) { System.out.println(toUUUUMM(LocalDate.now())); }
From source file:Main.java
public static void main(String[] args) { LocalDate tomorrow = LocalDate.now().plusDays(1); System.out.println(tomorrow); LocalDate yesterday = LocalDate.now().minusDays(1); System.out.println(yesterday); LocalDate lastWeek = LocalDate.now().minusWeeks(1); System.out.println(lastWeek); LocalDate nextYear = LocalDate.now().plusYears(1); System.out.println(nextYear); LocalDateTime inThreeHoursAndTwentyMinutes = LocalDateTime.now().plusHours(3).plusMinutes(20); System.out.println(inThreeHoursAndTwentyMinutes); }
From source file:Main.java
public static void main(String[] argv) { DayOfWeek d = LocalDate.now().with(TemporalAdjusters.lastDayOfMonth()).getDayOfWeek(); System.out.println(d);/*from w ww. j a va2s .c o m*/ }
From source file:Main.java
public static void main(String[] args) { Month m = Month.from(LocalDate.now()); Temporal n = m.adjustInto(LocalDate.now()); System.out.println(n);/*from w w w . j a v a2 s . com*/ }
From source file:Main.java
public static void main(String[] argv) { LocalDate today = LocalDate.now(); LocalDate tomorrow = today.plusDays(1); LocalDate yesterday = today.minus(1, DAYS); if (tomorrow.isAfter(today)) { System.out.println("Tomorrow comes after today"); }// ww w . jav a 2 s .c o m if (yesterday.isBefore(today)) { System.out.println("Yesterday is day before today"); } }
From source file:Main.java
public static void main(String[] args) { Month m = Month.from(LocalDate.now()); System.out.println(m.get(ChronoField.MONTH_OF_YEAR)); }
From source file:Main.java
public static void main(String[] args) { Month m = Month.from(LocalDate.now()); System.out.println(m.isSupported(ChronoField.MONTH_OF_YEAR)); }
From source file:Main.java
public static void main(String[] args) { Month m = Month.from(LocalDate.now()); System.out.println(m.getLong(ChronoField.MONTH_OF_YEAR)); }