List of usage examples for java.time LocalDate now
public static LocalDate now()
From source file:Main.java
public static void main(String[] args) { Month m = Month.from(LocalDate.now()); System.out.println(m.range(ChronoField.MONTH_OF_YEAR)); }
From source file:Main.java
public static void main(String[] args) { System.out.println(fromLocalDateIn(LocalDate.now(), ZoneOffset.UTC)); }
From source file:Main.java
public static void main(String[] argv) { LocalDate today = LocalDate.now(); LocalTime time = LocalTime.now(); LocalDateTime timeWithDate = LocalDateTime.now(); System.out.println("today = " + today); System.out.println("local date with time now = " + timeWithDate); System.out.println("time = " + time); }
From source file:Main.java
public static void main(String[] args) { LocalDate d = LocalDate.now().with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY)); System.out.println(d);//w w w . j a v a 2s . co m }
From source file:Main.java
public static void main(String[] args) { System.out.println(fromLocalDateInUTC(LocalDate.now())); }
From source file:Main.java
public static void main(String[] args) { LocalDateTime a = LocalDateTime.of(LocalDate.now(), LocalTime.NOON); System.out.println(a); }
From source file:Main.java
public static void main(String[] args) { LocalDate date = LocalDate.now(); LocalTime time = LocalTime.now(); LocalDateTime dateTimeFromDateAndTime = LocalDateTime.of(date, time); System.out.println(dateTimeFromDateAndTime); LocalDate dateFromDateTime = LocalDateTime.now().toLocalDate(); LocalTime timeFromDateTime = LocalDateTime.now().toLocalTime(); System.out.println(dateFromDateTime); System.out.println(timeFromDateTime); }
From source file:Main.java
public static void main(String[] args) { // Get the current local date LocalDate localDate1 = LocalDate.now(); System.out.println(localDate1); // Create a local date LocalDate localDate2 = LocalDate.of(2014, Month.JUNE, 21); System.out.println(localDate2); // 10000 days after the epoch date 1970-01-01 LocalDate localDate3 = LocalDate.ofEpochDay(10000); System.out.println(localDate3); }
From source file:Main.java
public static void main(String[] args) { // the current date LocalDate currentDate = LocalDate.now(); System.out.println(currentDate); // 2014-02-10 LocalDate tenthFeb2014 = LocalDate.of(2014, Month.FEBRUARY, 10); System.out.println(tenthFeb2014); // 2014-02-10 // months values start at 1 (2014-08-01) LocalDate firstAug2014 = LocalDate.of(2014, 8, 1); System.out.println(firstAug2014); // 2014-08-01 // the 65th day of 2010 (2010-03-06) LocalDate sixtyFifthDayOf2010 = LocalDate.ofYearDay(2010, 65); System.out.println(sixtyFifthDayOf2010); // 2014-03-06 }
From source file:Main.java
public static void main(String[] args) { LocalDate[] a = getWeekday(LocalDate.now()); System.out.println(Arrays.toString(a)); }