Java Code Examples for org.joda.time.LocalDate.fromDateFields()

The following are Jave code examples for showing how to use fromDateFields() of the org.joda.time.LocalDate class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: moneytracking   File: MoneyReminder.java   Source Code and License Vote up 6 votes
private Date createPlannedDate(String type, Date d) {
    LocalDate lo = LocalDate.fromDateFields(d);
    switch (type) {
        case "Daily":
            lo = lo.plusDays(1);
            break;
        case "Weekly":
            lo = lo.plusWeeks(1);
            break;
        case "Monthly":
            lo = lo.plusMonths(1);
            break;
        case "Yearly":
            lo = lo.plusYears(1);
            break;
    }
    return lo.toDate();
}
 
Example 2
Project: mobile-app-dev-book   File: MonthlyFragment.java   Source Code and License Vote up 5 votes
@Override
public boolean shouldDecorate(CalendarDay day) {
    LocalDate testDate = LocalDate.fromDateFields(day.getDate());
    if (tripDays.contains(testDate))
        return true;
    else
        return false;
}
 
Example 3
Project: mobile-app-dev-book   File: MonthlyFragment.java   Source Code and License Vote up 5 votes
@Override
public boolean shouldDecorate(CalendarDay day) {
    LocalDate testDate = LocalDate.fromDateFields(day.getDate());
    if (tripDays.contains(testDate))
        return true;
    else
        return false;
}
 
Example 4
Project: morf   File: ValueConverters.java   Source Code and License Vote up 4 votes
@Override
public LocalDate localDateValue(java.sql.Date value) {
  return LocalDate.fromDateFields(value);
}
 
Example 5
Project: asura   File: DateCalculator.java   Source Code and License Vote up 3 votes
/**
 * 计算日期相隔多少天
 *
 * 计算两个日期之间相隔多少天,忽略时分秒,忽略日期前后顺序
 *  如:2016-09-04 23:59:59 至 2016-09-05 00:00:01 返回相隔1天
 *  跨月如:2016-09-26 23:59:59 至 2016-10-08 00:00:01 返回相隔12天
 * @param date1 日期1
 * @param date2 日期2
 * @return
 */
public static int getBetweenDays(@NotNull Date date1, @NotNull Date date2) {
    Objects.requireNonNull(date1, "date1 must not null");
    Objects.requireNonNull(date2, "date2 must not null");
    LocalDate localDate1 = LocalDate.fromDateFields(date1);
    LocalDate localDate2 = LocalDate.fromDateFields(date2);
    return Math.abs(Days.daysBetween(localDate1, localDate2).getDays());
}