Java Code Examples for org.joda.time.DateTime#withDayOfWeek()
The following examples show how to use
org.joda.time.DateTime#withDayOfWeek() .
These examples are extracted from open source projects.
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 Project: dhis2-android-datacapture File: WeeklyPeriodFilter.java License: BSD 3-Clause "New" or "Revised" License | 5 votes |
private static DateTime fixEndDate(DateTime endDate) { if(endDate==null) { return null; } Calendar endDateCalendar = Calendar.getInstance(); endDateCalendar.setTime(endDate.toDate()); LocalDate fixedWeek = new LocalDate(endDate.withDayOfWeek(7)); endDateCalendar.setTime(fixedWeek.toDate()); return new DateTime(endDateCalendar.getTime()); }
Example 2
Source Project: fenixedu-academic File: GanttDiagram.java License: GNU Lesser General Public License v3.0 | 5 votes |
private void calculateFirstAndLastInstantInWeeklyMode(YearMonthDay begin) { if (begin == null) { throw new IllegalArgumentException(); } DateTime beginDateTime = begin.toDateTimeAtMidnight(); beginDateTime = (beginDateTime.getDayOfWeek() != 1) ? beginDateTime.withDayOfWeek(1) : beginDateTime; setFirstInstant(beginDateTime); setLastInstant(beginDateTime.plusDays(6)); }
Example 3
Source Project: liteflow File: TuesdayCalculator.java License: Apache License 2.0 | 4 votes |
@Override public DateTime calculate(DateTime dateTime) { return dateTime.withDayOfWeek(2); }
Example 4
Source Project: liteflow File: MondayCalculator.java License: Apache License 2.0 | 4 votes |
@Override public DateTime calculate(DateTime dateTime) { return dateTime.withDayOfWeek(1); }
Example 5
Source Project: liteflow File: ThursdayCalculator.java License: Apache License 2.0 | 4 votes |
@Override public DateTime calculate(DateTime dateTime) { return dateTime.withDayOfWeek(4); }
Example 6
Source Project: liteflow File: WednesdayCalculator.java License: Apache License 2.0 | 4 votes |
@Override public DateTime calculate(DateTime dateTime) { return dateTime.withDayOfWeek(3); }
Example 7
Source Project: liteflow File: FridayCalculator.java License: Apache License 2.0 | 4 votes |
@Override public DateTime calculate(DateTime dateTime) { return dateTime.withDayOfWeek(5); }
Example 8
Source Project: liteflow File: SundayCalculator.java License: Apache License 2.0 | 4 votes |
@Override public DateTime calculate(DateTime dateTime) { return dateTime.withDayOfWeek(7); }
Example 9
Source Project: liteflow File: SaturdayCalculator.java License: Apache License 2.0 | 4 votes |
@Override public DateTime calculate(DateTime dateTime) { return dateTime.withDayOfWeek(6); }
Example 10
Source Project: mojito File: DropScheduleService.java License: Apache License 2.0 | 3 votes |
DateTime getDropCreatedDate(DateTime dropDueDate) { DateTime dropCreatedDate = dropDueDate.withTime(dropScheduleConfig.getCreatedLocalTime()); Integer dropDueDateDay = dropDueDate.getDayOfWeek(); Integer dropStartDateDay = getDueDayToStartDay().get(dropDueDateDay); dropCreatedDate = dropCreatedDate.withDayOfWeek(dropStartDateDay); if (dropStartDateDay > dropDueDateDay) { dropCreatedDate = dropCreatedDate.minusWeeks(1); } return dropCreatedDate; }