Java Code Examples for org.joda.time.LocalDate#getDayOfMonth()
The following examples show how to use
org.joda.time.LocalDate#getDayOfMonth() .
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: AdministrativeOfficeDocument.java From fenixedu-academic with GNU Lesser General Public License v3.0 | 6 votes |
protected String getFormattedDate(LocalDate date) { final int dayOfMonth = date.getDayOfMonth(); final String month = date.toString("MMMM", getLocale()); final int year = date.getYear(); return new StringBuilder() .append(dayOfMonth) .append( (getLocale().equals(LocaleUtils.PT) ? EMPTY_STR : getDayOfMonthSuffixOfDate(dayOfMonth)) ) .append(SINGLE_SPACE) .append(BundleUtil.getString(Bundle.APPLICATION, getLocale(), "label.of")) .append(SINGLE_SPACE) .append( (getLocale().equals(LocaleUtils.PT)) ? month.toLowerCase() : month ) .append(SINGLE_SPACE) .append(BundleUtil.getString(Bundle.APPLICATION, getLocale(), "label.of")) .append(SINGLE_SPACE) .append(year) .toString(); }
Example 2
Source File: CalendarUtil.java From NCalendar with Apache License 2.0 | 6 votes |
/** * 获取CalendarDate CalendarDate包含需要显示的信息 农历,节气等 * @param localDate * @return */ public static CalendarDate getCalendarDate(LocalDate localDate) { CalendarDate calendarDate = new CalendarDate(); int solarYear = localDate.getYear(); int solarMonth = localDate.getMonthOfYear(); int solarDay = localDate.getDayOfMonth(); Lunar lunar = LunarUtil.getLunar(solarYear, solarMonth, solarDay); if (solarYear != 1900) { calendarDate.lunar = lunar; calendarDate.localDate = localDate; calendarDate.solarTerm = SolarTermUtil.getSolatName(solarYear, (solarMonth < 10 ? ("0" + solarMonth) : (solarMonth + "")) + solarDay); calendarDate.solarHoliday = HolidayUtil.getSolarHoliday(solarYear, solarMonth, solarDay); calendarDate.lunarHoliday = HolidayUtil.getLunarHoliday(lunar.lunarYear, lunar.lunarMonth, lunar.lunarDay); } return calendarDate; }
Example 3
Source File: CronExpression.java From chronos with BSD 3-Clause "New" or "Revised" License | 6 votes |
boolean matches(LocalDate dato) { for (FieldPart part : parts) { if ("L".equals(part.modifier)) { return dato.getDayOfWeek() == part.from && dato.getDayOfMonth() > (dato.dayOfMonth().getMaximumValue() - DAYS_PER_WEEK); } else if ("#".equals(part.incrementModifier)) { if (dato.getDayOfWeek() == part.from) { int num = dato.getDayOfMonth() / 7; return part.increment == (dato.getDayOfMonth() % 7 == 0 ? num : num + 1); } return false; } else if (matches(dato.getDayOfWeek(), part)) { return true; } } return false; }
Example 4
Source File: LocalDatePeriodCountCalculator.java From objectlabkit with Apache License 2.0 | 6 votes |
private int diff360EIsda(final LocalDate start, final LocalDate end) { if (start.equals(end)) { return 0; } int dayStart = start.getDayOfMonth(); int dayEnd = end.getDayOfMonth(); if (start.dayOfMonth().getMaximumValue() == dayStart) { dayStart = CalculatorConstants.MONTH_30_DAYS; } if (end.getMonthOfYear() != 2 && end.dayOfMonth().getMaximumValue() == dayEnd) { dayEnd = CalculatorConstants.MONTH_30_DAYS; } return (end.getYear() - start.getYear()) * CalculatorConstants.YEAR_360 + (end.getMonthOfYear() - start.getMonthOfYear()) * CalculatorConstants.MONTH_30_DAYS + dayEnd - dayStart; }
Example 5
Source File: CronExpression.java From actframework with Apache License 2.0 | 6 votes |
boolean matches(LocalDate dato) { for (FieldPart part : parts) { if ("L".equals(part.modifier)) { return dato.getDayOfWeek() == part.from && dato.getDayOfMonth() > (dato.dayOfMonth().getMaximumValue() - DAYS_PER_WEEK); } else if ("#".equals(part.incrementModifier)) { if (dato.getDayOfWeek() == part.from) { int num = dato.getDayOfMonth() / 7; return part.increment == (dato.getDayOfMonth() % 7 == 0 ? num : num + 1); } return false; } else if (matches(dato.getDayOfWeek(), part)) { return true; } } return false; }
Example 6
Source File: CronExpression.java From cron with Apache License 2.0 | 6 votes |
boolean matches(LocalDate dato) { for (FieldPart part : parts) { if ("L".equals(part.modifier)) { return dato.getDayOfMonth() == (dato.dayOfMonth().getMaximumValue() - (part.from == null ? 0 : part.from)); } else if ("W".equals(part.modifier)) { if (dato.getDayOfWeek() <= 5) { if (dato.getDayOfMonth() == part.from) { return true; } else if (dato.getDayOfWeek() == 5) { return dato.plusDays(1).getDayOfMonth() == part.from; } else if (dato.getDayOfWeek() == 1) { return dato.minusDays(1).getDayOfMonth() == part.from; } } } else if (matches(dato.getDayOfMonth(), part)) { return true; } } return false; }
Example 7
Source File: CronExpression.java From cron with Apache License 2.0 | 6 votes |
boolean matches(LocalDate dato) { for (FieldPart part : parts) { if ("L".equals(part.modifier)) { return dato.getDayOfWeek() == part.from && dato.getDayOfMonth() > (dato.dayOfMonth().getMaximumValue() - DAYS_PER_WEEK); } else if ("#".equals(part.incrementModifier)) { if (dato.getDayOfWeek() == part.from) { int num = dato.getDayOfMonth() / 7; return part.increment == (dato.getDayOfMonth() % 7 == 0 ? num : num + 1); } return false; } else if (matches(dato.getDayOfWeek(), part)) { return true; } } return false; }
Example 8
Source File: MainActivity.java From googlecalendar with Apache License 2.0 | 5 votes |
@Override public long getHeaderId(int position) { if (eventalllist.get(position).getType()==1)return position; else if (eventalllist.get(position).getType()==3)return position; else if (eventalllist.get(position).getType()==100)return position; else if (eventalllist.get(position).getType()==200)return position; LocalDate localDate=eventalllist.get(position).getLocalDate(); String uniquestr=""+localDate.getDayOfMonth()+localDate.getMonthOfYear()+localDate.getYear(); return Long.parseLong(uniquestr); }
Example 9
Source File: LocalDatePeriodCountCalculator.java From objectlabkit with Apache License 2.0 | 5 votes |
private int diffConv30v360(final LocalDate start, final LocalDate end) { int dayStart = start.getDayOfMonth(); int dayEnd = end.getDayOfMonth(); if (dayEnd == CalculatorConstants.MONTH_31_DAYS && dayStart >= CalculatorConstants.MONTH_30_DAYS) { dayEnd = CalculatorConstants.MONTH_30_DAYS; } if (dayStart == CalculatorConstants.MONTH_31_DAYS) { dayStart = CalculatorConstants.MONTH_30_DAYS; } return (end.getYear() - start.getYear()) * CalculatorConstants.YEAR_360 + (end.getMonthOfYear() - start.getMonthOfYear()) * CalculatorConstants.MONTH_30_DAYS + dayEnd - dayStart; }
Example 10
Source File: LocalDatePeriodCountCalculator.java From objectlabkit with Apache License 2.0 | 5 votes |
private int diff360EIsma(final LocalDate start, final LocalDate end) { int dayStart = start.getDayOfMonth(); int dayEnd = end.getDayOfMonth(); if (dayEnd == CalculatorConstants.MONTH_31_DAYS) { dayEnd = CalculatorConstants.MONTH_30_DAYS; } if (dayStart == CalculatorConstants.MONTH_31_DAYS) { dayStart = CalculatorConstants.MONTH_30_DAYS; } return (end.getYear() - start.getYear()) * CalculatorConstants.YEAR_360 + (end.getMonthOfYear() - start.getMonthOfYear()) * CalculatorConstants.MONTH_30_DAYS + dayEnd - dayStart; }
Example 11
Source File: ImsakiyeFragment.java From prayer-times-android with Apache License 2.0 | 5 votes |
public ImsakiyeAdapter(Context context) { LocalDate now = LocalDate.now(); today = now.getDayOfMonth(); date = now.withDayOfMonth(1); daysInMonth = date.dayOfMonth().getMaximumValue(); inflater = LayoutInflater.from(context); }
Example 12
Source File: ImsakiyeFragment.java From prayer-times-android with Apache License 2.0 | 5 votes |
public ImsakiyeAdapter(Context context) { LocalDate now = LocalDate.now(); today = now.getDayOfMonth(); date = now.withDayOfMonth(1); daysInMonth = date.dayOfMonth().getMaximumValue(); inflater = LayoutInflater.from(context); }
Example 13
Source File: Time_11_ZoneInfoCompiler_t.java From coming with MIT License | 4 votes |
DateTimeOfYear(StringTokenizer st) { int month = 1; int day = 1; int dayOfWeek = 0; int millis = 0; boolean advance = false; char zoneChar = 'w'; if (st.hasMoreTokens()) { month = parseMonth(st.nextToken()); if (st.hasMoreTokens()) { String str = st.nextToken(); if (str.startsWith("last")) { day = -1; dayOfWeek = parseDayOfWeek(str.substring(4)); advance = false; } else { try { day = Integer.parseInt(str); dayOfWeek = 0; advance = false; } catch (NumberFormatException e) { int index = str.indexOf(">="); if (index > 0) { day = Integer.parseInt(str.substring(index + 2)); dayOfWeek = parseDayOfWeek(str.substring(0, index)); advance = true; } else { index = str.indexOf("<="); if (index > 0) { day = Integer.parseInt(str.substring(index + 2)); dayOfWeek = parseDayOfWeek(str.substring(0, index)); advance = false; } else { throw new IllegalArgumentException(str); } } } } if (st.hasMoreTokens()) { str = st.nextToken(); zoneChar = parseZoneChar(str.charAt(str.length() - 1)); if (str.equals("24:00")) { LocalDate date = (day == -1 ? new LocalDate(2001, month, 1).plusMonths(1) : new LocalDate(2001, month, day).plusDays(1)); advance = (day != -1); month = date.getMonthOfYear(); day = date.getDayOfMonth(); dayOfWeek = ((dayOfWeek - 1 + 1) % 7) + 1; } else { millis = parseTime(str); } } } } iMonthOfYear = month; iDayOfMonth = day; iDayOfWeek = dayOfWeek; iAdvanceDayOfWeek = advance; iMillisOfDay = millis; iZoneChar = zoneChar; }
Example 14
Source File: Time_11_ZoneInfoCompiler_s.java From coming with MIT License | 4 votes |
DateTimeOfYear(StringTokenizer st) { int month = 1; int day = 1; int dayOfWeek = 0; int millis = 0; boolean advance = false; char zoneChar = 'w'; if (st.hasMoreTokens()) { month = parseMonth(st.nextToken()); if (st.hasMoreTokens()) { String str = st.nextToken(); if (str.startsWith("last")) { day = -1; dayOfWeek = parseDayOfWeek(str.substring(4)); advance = false; } else { try { day = Integer.parseInt(str); dayOfWeek = 0; advance = false; } catch (NumberFormatException e) { int index = str.indexOf(">="); if (index > 0) { day = Integer.parseInt(str.substring(index + 2)); dayOfWeek = parseDayOfWeek(str.substring(0, index)); advance = true; } else { index = str.indexOf("<="); if (index > 0) { day = Integer.parseInt(str.substring(index + 2)); dayOfWeek = parseDayOfWeek(str.substring(0, index)); advance = false; } else { throw new IllegalArgumentException(str); } } } } if (st.hasMoreTokens()) { str = st.nextToken(); zoneChar = parseZoneChar(str.charAt(str.length() - 1)); if (str.equals("24:00")) { LocalDate date = (day == -1 ? new LocalDate(2001, month, 1).plusMonths(1) : new LocalDate(2001, month, day).plusDays(1)); advance = (day != -1); month = date.getMonthOfYear(); day = date.getDayOfMonth(); dayOfWeek = ((dayOfWeek - 1 + 1) % 7) + 1; } else { millis = parseTime(str); } } } } iMonthOfYear = month; iDayOfMonth = day; iDayOfWeek = dayOfWeek; iAdvanceDayOfWeek = advance; iMillisOfDay = millis; iZoneChar = zoneChar; }
Example 15
Source File: PeriodUtil.java From estatio with Apache License 2.0 | 4 votes |
private static boolean matchesEndFinancialYear(final LocalDate date){ return date.getDayOfMonth() == 30 && date.getMonthOfYear() == 6 ? true : false; }
Example 16
Source File: ZoneInfoCompiler.java From astor with GNU General Public License v2.0 | 4 votes |
DateTimeOfYear(StringTokenizer st) { int month = 1; int day = 1; int dayOfWeek = 0; int millis = 0; boolean advance = false; char zoneChar = 'w'; if (st.hasMoreTokens()) { month = parseMonth(st.nextToken()); if (st.hasMoreTokens()) { String str = st.nextToken(); if (str.startsWith("last")) { day = -1; dayOfWeek = parseDayOfWeek(str.substring(4)); advance = false; } else { try { day = Integer.parseInt(str); dayOfWeek = 0; advance = false; } catch (NumberFormatException e) { int index = str.indexOf(">="); if (index > 0) { day = Integer.parseInt(str.substring(index + 2)); dayOfWeek = parseDayOfWeek(str.substring(0, index)); advance = true; } else { index = str.indexOf("<="); if (index > 0) { day = Integer.parseInt(str.substring(index + 2)); dayOfWeek = parseDayOfWeek(str.substring(0, index)); advance = false; } else { throw new IllegalArgumentException(str); } } } } if (st.hasMoreTokens()) { str = st.nextToken(); zoneChar = parseZoneChar(str.charAt(str.length() - 1)); if (str.equals("24:00")) { LocalDate date = (day == -1 ? new LocalDate(2001, month, 1).plusMonths(1) : new LocalDate(2001, month, day).plusDays(1)); advance = (day != -1); month = date.getMonthOfYear(); day = date.getDayOfMonth(); dayOfWeek = ((dayOfWeek - 1 + 1) % 7) + 1; } else { millis = parseTime(str); } } } } iMonthOfYear = month; iDayOfMonth = day; iDayOfWeek = dayOfWeek; iAdvanceDayOfWeek = advance; iMillisOfDay = millis; iZoneChar = zoneChar; }
Example 17
Source File: ZoneInfoCompiler.java From astor with GNU General Public License v2.0 | 4 votes |
DateTimeOfYear(StringTokenizer st) { int month = 1; int day = 1; int dayOfWeek = 0; int millis = 0; boolean advance = false; char zoneChar = 'w'; if (st.hasMoreTokens()) { month = parseMonth(st.nextToken()); if (st.hasMoreTokens()) { String str = st.nextToken(); if (str.startsWith("last")) { day = -1; dayOfWeek = parseDayOfWeek(str.substring(4)); advance = false; } else { try { day = Integer.parseInt(str); dayOfWeek = 0; advance = false; } catch (NumberFormatException e) { int index = str.indexOf(">="); if (index > 0) { day = Integer.parseInt(str.substring(index + 2)); dayOfWeek = parseDayOfWeek(str.substring(0, index)); advance = true; } else { index = str.indexOf("<="); if (index > 0) { day = Integer.parseInt(str.substring(index + 2)); dayOfWeek = parseDayOfWeek(str.substring(0, index)); advance = false; } else { throw new IllegalArgumentException(str); } } } } if (st.hasMoreTokens()) { str = st.nextToken(); zoneChar = parseZoneChar(str.charAt(str.length() - 1)); if (str.equals("24:00")) { LocalDate date = (day == -1 ? new LocalDate(2001, month, 1).plusMonths(1) : new LocalDate(2001, month, day).plusDays(1)); advance = (day != -1); month = date.getMonthOfYear(); day = date.getDayOfMonth(); dayOfWeek = ((dayOfWeek - 1 + 1) % 7) + 1; } else { millis = parseTime(str); } } } } iMonthOfYear = month; iDayOfMonth = day; iDayOfWeek = dayOfWeek; iAdvanceDayOfWeek = advance; iMillisOfDay = millis; iZoneChar = zoneChar; }
Example 18
Source File: PeriodUtil.java From estatio with Apache License 2.0 | 4 votes |
private static boolean matchesEndCalendarYear(final LocalDate date){ return date.getDayOfMonth() == 31 && date.getMonthOfYear() == 12 ? true : false; }
Example 19
Source File: PeriodUtil.java From estatio with Apache License 2.0 | 4 votes |
private static boolean matchesStartFinancialYear(final LocalDate date){ return date.getDayOfMonth() == 1 && date.getMonthOfYear() == 7 ? true : false; }
Example 20
Source File: PeriodUtil.java From estatio with Apache License 2.0 | 4 votes |
private static boolean matchesStartCalendarYear(final LocalDate date){ return date.getDayOfMonth() == 1 && date.getMonthOfYear() == 1 ? true : false; }