Java Code Examples for java.time.DayOfWeek#SUNDAY
The following examples show how to use
java.time.DayOfWeek#SUNDAY .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestDateUtil.java From sailfish-core with Apache License 2.0 | 6 votes |
@Test public void testBusinessGetDateWithCustomWeekends() { LocalDateTime currentTime = dateUtil.getDateTime(); DayOfWeek dayOfWeek = currentTime.getDayOfWeek(); DayOfWeek customWeekend = DayOfWeek.SUNDAY; int toSunday = customWeekend.getValue() - dayOfWeek.getValue(); String nearestSundayInFuture = "D+" + toSunday; LocalDateTime businessDateTime = dateUtil.getBusinessDateTime(nearestSundayInFuture, customWeekend.name()); assertEquals(DayOfWeek.MONDAY, businessDateTime.getDayOfWeek()); String nearestSundayInPast = "D-" + Math.min(dayOfWeek.getValue(), 6); businessDateTime = dateUtil.getBusinessDateTime(nearestSundayInPast, customWeekend.name()); assertEquals(DayOfWeek.SATURDAY, businessDateTime.getDayOfWeek()); }
Example 2
Source File: TCKWeekFields.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
@DataProvider(name="IsoWeekData") Object[][] data_week() { return new Object[][] { {LocalDate.of(1969, 12, 29), DayOfWeek.MONDAY, 1, 1970}, {LocalDate.of(2012, 12, 23), DayOfWeek.SUNDAY, 51, 2012}, {LocalDate.of(2012, 12, 24), DayOfWeek.MONDAY, 52, 2012}, {LocalDate.of(2012, 12, 27), DayOfWeek.THURSDAY, 52, 2012}, {LocalDate.of(2012, 12, 28), DayOfWeek.FRIDAY, 52, 2012}, {LocalDate.of(2012, 12, 29), DayOfWeek.SATURDAY, 52, 2012}, {LocalDate.of(2012, 12, 30), DayOfWeek.SUNDAY, 52, 2012}, {LocalDate.of(2012, 12, 31), DayOfWeek.MONDAY, 1, 2013}, {LocalDate.of(2013, 1, 1), DayOfWeek.TUESDAY, 1, 2013}, {LocalDate.of(2013, 1, 2), DayOfWeek.WEDNESDAY, 1, 2013}, {LocalDate.of(2013, 1, 6), DayOfWeek.SUNDAY, 1, 2013}, {LocalDate.of(2013, 1, 7), DayOfWeek.MONDAY, 2, 2013}, }; }
Example 3
Source File: TCKWeekFields.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
@DataProvider(name="IsoWeekData") Object[][] data_week() { return new Object[][] { {LocalDate.of(1969, 12, 29), DayOfWeek.MONDAY, 1, 1970}, {LocalDate.of(2012, 12, 23), DayOfWeek.SUNDAY, 51, 2012}, {LocalDate.of(2012, 12, 24), DayOfWeek.MONDAY, 52, 2012}, {LocalDate.of(2012, 12, 27), DayOfWeek.THURSDAY, 52, 2012}, {LocalDate.of(2012, 12, 28), DayOfWeek.FRIDAY, 52, 2012}, {LocalDate.of(2012, 12, 29), DayOfWeek.SATURDAY, 52, 2012}, {LocalDate.of(2012, 12, 30), DayOfWeek.SUNDAY, 52, 2012}, {LocalDate.of(2012, 12, 31), DayOfWeek.MONDAY, 1, 2013}, {LocalDate.of(2013, 1, 1), DayOfWeek.TUESDAY, 1, 2013}, {LocalDate.of(2013, 1, 2), DayOfWeek.WEDNESDAY, 1, 2013}, {LocalDate.of(2013, 1, 6), DayOfWeek.SUNDAY, 1, 2013}, {LocalDate.of(2013, 1, 7), DayOfWeek.MONDAY, 2, 2013}, }; }
Example 4
Source File: MarketDayUtil.java From java-trader with Apache License 2.0 | 6 votes |
/** * 上一个交易日 */ public static LocalDate prevMarketDay(Exchange exchange, LocalDate tradingDay, boolean stopOnHolidy){ if ( exchange==null ) { exchange = Exchange.SSE; } List<LocalDate> closeDays = closeDayMap.get(exchange.name()); while(true){ tradingDay = tradingDay.plusDays(-1); DayOfWeek dayOfWeek = tradingDay.getDayOfWeek(); if ( dayOfWeek == DayOfWeek.SUNDAY || dayOfWeek==DayOfWeek.SATURDAY) { continue; } if ( closeDays!=null && closeDays.contains(tradingDay) ) { if ( !stopOnHolidy ) { continue; } tradingDay = null; break; } break; } return tradingDay; }
Example 5
Source File: TestStart.java From LGoodDatePicker with MIT License | 6 votes |
/** * getHighlightInformationOrNull, Implement this function to indicate if a date should be * highlighted, and what highlighting details should be used for the highlighted date. * * If a date should be highlighted, then return an instance of HighlightInformation. If the * date should not be highlighted, then return null. * * You may (optionally) fill out the fields in the HighlightInformation class to give any * particular highlighted day a unique foreground color, background color, or tooltip text. * If the color fields are null, then the default highlighting colors will be used. If the * tooltip field is null (or empty), then no tooltip will be displayed. * * Dates that are passed to this function will never be null. */ @Override public HighlightInformation getHighlightInformationOrNull(LocalDate date) { // Highlight a chosen date, with a tooltip and a red background color. if (date.getDayOfMonth() == 25) { return new HighlightInformation(Color.red, null, "It's the 25th!"); } // Highlight all Saturdays with a unique background and foreground color. if (date.getDayOfWeek() == DayOfWeek.SATURDAY) { return new HighlightInformation(Color.orange, Color.yellow, "It's Saturday!"); } // Highlight all Sundays with default colors and a tooltip. if (date.getDayOfWeek() == DayOfWeek.SUNDAY) { return new HighlightInformation(null, null, "It's Sunday!"); } // All other days should not be highlighted. return null; }
Example 6
Source File: TCKWeekFields.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
@DataProvider(name="IsoWeekData") Object[][] data_week() { return new Object[][] { {LocalDate.of(1969, 12, 29), DayOfWeek.MONDAY, 1, 1970}, {LocalDate.of(2012, 12, 23), DayOfWeek.SUNDAY, 51, 2012}, {LocalDate.of(2012, 12, 24), DayOfWeek.MONDAY, 52, 2012}, {LocalDate.of(2012, 12, 27), DayOfWeek.THURSDAY, 52, 2012}, {LocalDate.of(2012, 12, 28), DayOfWeek.FRIDAY, 52, 2012}, {LocalDate.of(2012, 12, 29), DayOfWeek.SATURDAY, 52, 2012}, {LocalDate.of(2012, 12, 30), DayOfWeek.SUNDAY, 52, 2012}, {LocalDate.of(2012, 12, 31), DayOfWeek.MONDAY, 1, 2013}, {LocalDate.of(2013, 1, 1), DayOfWeek.TUESDAY, 1, 2013}, {LocalDate.of(2013, 1, 2), DayOfWeek.WEDNESDAY, 1, 2013}, {LocalDate.of(2013, 1, 6), DayOfWeek.SUNDAY, 1, 2013}, {LocalDate.of(2013, 1, 7), DayOfWeek.MONDAY, 2, 2013}, }; }
Example 7
Source File: TestTextParser.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
@DataProvider(name="parseDayOfWeekText") Object[][] providerDayOfWeekData() { return new Object[][] { // Locale, pattern, input text, expected DayOfWeek {Locale.US, "e", "1", DayOfWeek.SUNDAY}, {Locale.US, "ee", "01", DayOfWeek.SUNDAY}, {Locale.US, "c", "1", DayOfWeek.SUNDAY}, {Locale.UK, "e", "1", DayOfWeek.MONDAY}, {Locale.UK, "ee", "01", DayOfWeek.MONDAY}, {Locale.UK, "c", "1", DayOfWeek.MONDAY}, }; }
Example 8
Source File: AddSubtractDaysSkippingWeekendsUtils.java From tutorials with MIT License | 5 votes |
public static LocalDate addDaysSkippingWeekends(LocalDate date, int days) { LocalDate result = date; int addedDays = 0; while (addedDays < days) { result = result.plusDays(1); if (!(result.getDayOfWeek() == DayOfWeek.SATURDAY || result.getDayOfWeek() == DayOfWeek.SUNDAY)) { ++addedDays; } } return result; }
Example 9
Source File: TestTextPrinter.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
@DataProvider(name="print_DayOfWeekData") Object[][] providerDayOfWeekData() { return new Object[][] { // Locale, pattern, expected text, input DayOfWeek {Locale.US, "e", "1", DayOfWeek.SUNDAY}, {Locale.US, "ee", "01", DayOfWeek.SUNDAY}, {Locale.US, "c", "1", DayOfWeek.SUNDAY}, {Locale.UK, "e", "1", DayOfWeek.MONDAY}, {Locale.UK, "ee", "01", DayOfWeek.MONDAY}, {Locale.UK, "c", "1", DayOfWeek.MONDAY}, }; }
Example 10
Source File: TestTextPrinter.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@DataProvider(name="print_DayOfWeekData") Object[][] providerDayOfWeekData() { return new Object[][] { // Locale, pattern, expected text, input DayOfWeek {Locale.US, "e", "1", DayOfWeek.SUNDAY}, {Locale.US, "ee", "01", DayOfWeek.SUNDAY}, {Locale.US, "c", "1", DayOfWeek.SUNDAY}, {Locale.UK, "e", "1", DayOfWeek.MONDAY}, {Locale.UK, "ee", "01", DayOfWeek.MONDAY}, {Locale.UK, "c", "1", DayOfWeek.MONDAY}, }; }
Example 11
Source File: TestTextParser.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@DataProvider(name="parseDayOfWeekText") Object[][] providerDayOfWeekData() { return new Object[][] { // Locale, pattern, input text, expected DayOfWeek {Locale.US, "e", "1", DayOfWeek.SUNDAY}, {Locale.US, "ee", "01", DayOfWeek.SUNDAY}, {Locale.US, "c", "1", DayOfWeek.SUNDAY}, }; }
Example 12
Source File: BusinessdayCalendarExcludingGivenHolidays.java From finmath-lib with Apache License 2.0 | 5 votes |
@Override public boolean isBusinessday(final LocalDate date) { return (baseCalendar == null || baseCalendar.isBusinessday(date)) && (isExcludingWeekends() && date.getDayOfWeek() != DayOfWeek.SATURDAY && date.getDayOfWeek() != DayOfWeek.SUNDAY ) && !getHolidays().contains(date); }
Example 13
Source File: MarketDayUtil.java From java-trader with Apache License 2.0 | 5 votes |
public static boolean isMarketDay(Exchange exchange, LocalDate tradingDay){ if ( exchange==null ) { exchange = Exchange.SSE; } List<LocalDate> closeDays = closeDayMap.get(exchange.name()); DayOfWeek dayOfWeek = tradingDay.getDayOfWeek(); if ( dayOfWeek == DayOfWeek.SUNDAY || dayOfWeek==DayOfWeek.SATURDAY){ return false; } if ( closeDays!=null && closeDays.contains(tradingDay) ) { return false; } return true; }
Example 14
Source File: TestTextParser.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@DataProvider(name="parseDayOfWeekText") Object[][] providerDayOfWeekData() { return new Object[][] { // Locale, pattern, input text, expected DayOfWeek {Locale.US, "e", "1", DayOfWeek.SUNDAY}, {Locale.US, "ee", "01", DayOfWeek.SUNDAY}, {Locale.US, "c", "1", DayOfWeek.SUNDAY}, {Locale.UK, "e", "1", DayOfWeek.MONDAY}, {Locale.UK, "ee", "01", DayOfWeek.MONDAY}, {Locale.UK, "c", "1", DayOfWeek.MONDAY}, }; }
Example 15
Source File: TestTextParser.java From hottub with GNU General Public License v2.0 | 5 votes |
@DataProvider(name="parseDayOfWeekText") Object[][] providerDayOfWeekData() { return new Object[][] { // Locale, pattern, input text, expected DayOfWeek {Locale.US, "e", "1", DayOfWeek.SUNDAY}, {Locale.US, "ee", "01", DayOfWeek.SUNDAY}, {Locale.US, "c", "1", DayOfWeek.SUNDAY}, {Locale.UK, "e", "1", DayOfWeek.MONDAY}, {Locale.UK, "ee", "01", DayOfWeek.MONDAY}, {Locale.UK, "c", "1", DayOfWeek.MONDAY}, }; }
Example 16
Source File: SiegeScheduleDate.java From L2jOrg with GNU General Public License v3.0 | 4 votes |
public SiegeScheduleDate() { this.day = DayOfWeek.SUNDAY; this.hour = 20; this.maxConcurrent = 5; }
Example 17
Source File: TimeSection.java From OEE-Designer with MIT License | 4 votes |
public TimeSection(final LocalTime START, final LocalTime STOP, final Color COLOR) { this(START, STOP, "", null, COLOR, COLOR, Color.TRANSPARENT, false, DayOfWeek.MONDAY, DayOfWeek.TUESDAY, DayOfWeek.WEDNESDAY, DayOfWeek.THURSDAY, DayOfWeek.FRIDAY, DayOfWeek.SATURDAY, DayOfWeek.SUNDAY); }
Example 18
Source File: TimeSection.java From tilesfx with Apache License 2.0 | 4 votes |
public TimeSection(final LocalTime START, final LocalTime STOP, final Color COLOR, final Color HIGHLIGHT_COLOR) { this(START, STOP, "", null, COLOR, HIGHLIGHT_COLOR, Color.TRANSPARENT, false, DayOfWeek.MONDAY, DayOfWeek.TUESDAY, DayOfWeek.WEDNESDAY, DayOfWeek.THURSDAY, DayOfWeek.FRIDAY, DayOfWeek.SATURDAY, DayOfWeek.SUNDAY); }
Example 19
Source File: TimeSection.java From OEE-Designer with MIT License | 4 votes |
public TimeSection(final LocalTime START, final LocalTime STOP, final String TEXT, final Color COLOR) { this(START, STOP, TEXT, null, COLOR, COLOR, Color.WHITE, false, DayOfWeek.MONDAY, DayOfWeek.TUESDAY, DayOfWeek.WEDNESDAY, DayOfWeek.THURSDAY, DayOfWeek.FRIDAY, DayOfWeek.SATURDAY, DayOfWeek.SUNDAY); }
Example 20
Source File: TimeSection.java From OEE-Designer with MIT License | 4 votes |
public TimeSection(final LocalTime START, final LocalTime STOP, final String TEXT, final Color COLOR, final Color TEXT_COLOR) { this(START, STOP, TEXT, null, COLOR, COLOR, TEXT_COLOR, false, DayOfWeek.MONDAY, DayOfWeek.TUESDAY, DayOfWeek.WEDNESDAY, DayOfWeek.THURSDAY, DayOfWeek.FRIDAY, DayOfWeek.SATURDAY, DayOfWeek.SUNDAY); }