List of usage examples for java.time DayOfWeek MONDAY
DayOfWeek MONDAY
To view the source code for java.time DayOfWeek MONDAY.
Click Source Link
From source file:Main.java
public static void main(String[] args) { DayOfWeek dayOfWeek = DayOfWeek.MONDAY; System.out.println(dayOfWeek.name()); System.out.println(dayOfWeek.getValue()); System.out.println(dayOfWeek.ordinal()); }
From source file:Main.java
public static void main(String[] args) { System.out.println(DayOfWeek.MONDAY); System.out.println(DayOfWeek.TUESDAY); System.out.printf("%s%n", DayOfWeek.MONDAY.plus(3)); System.out.printf("%s%n", DayOfWeek.MONDAY.plus(401)); System.out.printf("%s%n", DayOfWeek.MONDAY.minus(401)); }
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 ww. j a v a2 s . c om }
From source file:Main.java
public static void main(String[] args) { Locale defaultLocale = Locale.getDefault(); Locale france = Locale.FRANCE; System.out.printf("%s%n", DayOfWeek.MONDAY.minus(401).getDisplayName(TextStyle.SHORT, defaultLocale)); System.out.printf("%s%n", DayOfWeek.MONDAY.minus(401).getDisplayName(TextStyle.SHORT, france)); }
From source file:Main.java
public static void main(String[] args) { Month month = Month.valueOf("March".toUpperCase()); System.out.printf("For the month of %s:%n", month); LocalDate date = Year.now().atMonth(month).atDay(1).with(TemporalAdjusters.firstInMonth(DayOfWeek.MONDAY)); Month mi = date.getMonth();// ww w .j a v a 2 s.co m while (mi == month) { System.out.printf("%s%n", date); date = date.with(TemporalAdjusters.next(DayOfWeek.MONDAY)); mi = date.getMonth(); } }
From source file:Main.java
public static void main(String[] args) { LocalDate date = LocalDate.of(2014, Month.JULY, 16); System.out.println(date);/*from www. ja v a 2s . c om*/ LocalDate firstDayOfJuly = date.with(TemporalAdjusters.firstDayOfMonth()); // 2014-07-01 System.out.println(firstDayOfJuly); LocalDate dateOfFirstMonday = date.with(TemporalAdjusters.firstInMonth(DayOfWeek.MONDAY)); // 2014-07-07 System.out.println(dateOfFirstMonday); }
From source file:ListMondays.java
public static void main(String[] args) { Month month = null;//from w w w. j a va 2s. c om if (args.length < 1) { System.out.printf("Usage: ListMondays <month>%n"); throw new IllegalArgumentException(); } try { month = Month.valueOf(args[0].toUpperCase()); } catch (IllegalArgumentException exc) { System.out.printf("%s is not a valid month.%n", args[0]); throw exc; // Rethrow the exception. } System.out.printf("For the month of %s:%n", month); LocalDate date = Year.now().atMonth(month).atDay(1).with(TemporalAdjusters.firstInMonth(DayOfWeek.MONDAY)); Month mi = date.getMonth(); while (mi == month) { System.out.printf("%s%n", date); date = date.with(TemporalAdjusters.next(DayOfWeek.MONDAY)); mi = date.getMonth(); } }
From source file:Main.java
private static LocalDate firstDayOfCalendar(YearMonth month) { DayOfWeek FIRST_DAY_OF_WEEK = DayOfWeek.MONDAY; return month.atDay(1).with(FIRST_DAY_OF_WEEK); }
From source file:Main.java
public static Boolean queryFrom(TemporalAccessor temporal) { if (temporal.isSupported(ChronoField.DAY_OF_MONTH) && temporal.isSupported(ChronoField.DAY_OF_WEEK)) { int dayOfMonth = temporal.get(ChronoField.DAY_OF_MONTH); int weekDay = temporal.get(ChronoField.DAY_OF_WEEK); DayOfWeek dayOfWeek = DayOfWeek.of(weekDay); if (dayOfMonth == 1 && dayOfWeek == DayOfWeek.MONDAY) { return Boolean.TRUE; }//w w w . jav a2 s . co m } return Boolean.FALSE; }
From source file:Main.java
@Override public Boolean queryFrom(TemporalAccessor temporal) { if (temporal.isSupported(ChronoField.DAY_OF_MONTH) && temporal.isSupported(ChronoField.DAY_OF_WEEK)) { int dayOfMonth = temporal.get(ChronoField.DAY_OF_MONTH); int weekDay = temporal.get(ChronoField.DAY_OF_WEEK); DayOfWeek dayOfWeek = DayOfWeek.of(weekDay); if (dayOfMonth == 1 && dayOfWeek == DayOfWeek.MONDAY) { return Boolean.TRUE; }//w ww. j a va 2s .c om } return Boolean.FALSE; }