List of usage examples for java.time Month FEBRUARY
Month FEBRUARY
To view the source code for java.time Month FEBRUARY.
Click Source Link
From source file:Main.java
public static void main(String[] args) { Month m = Month.FEBRUARY; System.out.println(m.getValue()); System.out.println(m.name()); System.out.println(m.ordinal()); }
From source file:Main.java
public static void main(String[] args) { LocalDate date = LocalDate.of(2014, Month.FEBRUARY, 25); // 2014-02-25 // last day of February 2014 (2014-02-28) LocalDate lastDayOfMonth = date.with(TemporalAdjusters.lastDayOfMonth()); System.out.println(lastDayOfMonth); }
From source file:Main.java
public static void main(String[] args) { LocalDate date = LocalDate.of(2014, Month.FEBRUARY, 25); // 2014-02-25 // first day of February 2014 (2014-02-01) LocalDate firstDayOfMonth = date.with(TemporalAdjusters.firstDayOfMonth()); System.out.println(firstDayOfMonth); }
From source file:Main.java
public static void main(String[] args) { LocalDate date = LocalDate.of(2014, Month.FEBRUARY, 25); // 2014-02-25 // last day of 2014 (2014-12-31) LocalDate lastDayOfYear = date.with(TemporalAdjusters.lastDayOfYear()); System.out.println(lastDayOfYear); }
From source file:Main.java
public static void main(String[] args) { LocalDate date = LocalDate.of(2014, Month.FEBRUARY, 25); // 2014-02-25 // first day of next month (2014-03-01) LocalDate firstDayOfNextMonth = date.with(TemporalAdjusters.firstDayOfNextMonth()); System.out.println(firstDayOfNextMonth); }
From source file:Main.java
public static void main(String[] args) { Period employmentPeriod = period(LocalDate.of(2000, Month.FEBRUARY, 1)); int years = employmentPeriod.getYears(); int months = employmentPeriod.getMonths(); int days = employmentPeriod.getDays(); System.out.println(years);//from w w w . j av a 2s . c o m System.out.println(months); System.out.println(days); }
From source file:Main.java
public static void main(String[] args) { LocalDate startEmployment = LocalDate.of(2011, Month.FEBRUARY, 1); LocalDate today = LocalDate.now(); long numberOfDays = startEmployment.until(today, ChronoUnit.DAYS); System.out.println(String.format("%d", numberOfDays)); }
From source file:Main.java
public static void main(String[] args) { LocalDate date = LocalDate.of(2014, Month.FEBRUARY, 25); // 2014-02-25 // next Sunday (2014-03-02) LocalDate nextSunday = date.with(TemporalAdjusters.next(DayOfWeek.SUNDAY)); System.out.println(nextSunday); }
From source file:Main.java
public static void main(String[] args) { LocalDate date = LocalDate.of(2014, Month.FEBRUARY, 15); // 2014-02-15 DayOfWeek dayOfWeek = date.getDayOfWeek(); // SATURDAY dayOfWeek = DayOfWeek.FRIDAY; Locale locale = Locale.getDefault(); System.out.println(dayOfWeek.getDisplayName(TextStyle.FULL, locale)); // Friday System.out.println(dayOfWeek.getDisplayName(TextStyle.NARROW, locale)); // F System.out.println(dayOfWeek.getDisplayName(TextStyle.SHORT, locale)); // Fri }
From source file:Main.java
public static void main(String[] args) { LocalDate february20th = LocalDate.of(2014, Month.FEBRUARY, 20); System.out.println(february20th); System.out.println(LocalDate.from(february20th.plus(15, ChronoUnit.YEARS))); // 2029-02-20 System.out.println(LocalDate.MAX); System.out.println(LocalDate.MIN); System.out.println(LocalTime.MIDNIGHT); // 00:00 System.out.println(LocalTime.NOON); // 12:00 System.out.println(LocalTime.of(23, 12, 30, 500)); // 23:12:30.000000500 System.out.println(LocalTime.now()); // 00:40:34.110 System.out.println(LocalTime.ofSecondOfDay(11 * 60 * 60)); // 11:00 System.out.println(LocalTime.from(LocalTime.MIDNIGHT.plusHours(4))); // 04:00 System.out.println(LocalTime.MIN); System.out.println(LocalTime.MAX); System.out.println(LocalDateTime.of(2014, 2, 15, 12, 30, 50, 200)); // 2014-02-15T12:30:50.000000200 System.out.println(LocalDateTime.now()); // 2014-02-28T17:28:21.002 System.out.println(LocalDateTime.from(LocalDateTime.of(2014, 2, 15, 12, 30, 40, 500).plusHours(19))); // 2014-02-16T07:30:40.000000500 System.out.println(LocalDateTime.MAX); }