本文整理汇总了Java中org.joda.time.DateMidnight.getMonthOfYear方法的典型用法代码示例。如果您正苦于以下问题:Java DateMidnight.getMonthOfYear方法的具体用法?Java DateMidnight.getMonthOfYear怎么用?Java DateMidnight.getMonthOfYear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.joda.time.DateMidnight
的用法示例。
在下文中一共展示了DateMidnight.getMonthOfYear方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getVacationOverviews
import org.joda.time.DateMidnight; //导入方法依赖的package包/类
public List<VacationOverview> getVacationOverviews(String selectedDepartment,
Integer selectedYear,
Integer selectedMonth) {
List<VacationOverview> holidayOverviewList = new ArrayList<>();
Department department = getDepartmentByName(selectedDepartment);
if (department != null) {
for (Person person : department.getMembers()) {
DateMidnight date = new DateMidnight();
int year = selectedYear != null ? selectedYear : date.getYear();
int month = selectedMonth != null ? selectedMonth : date.getMonthOfYear();
DateMidnight lastDay = DateUtil.getLastDayOfMonth(year, month);
VacationOverview holidayOverview = getVacationOverview(person);
for (int i = 1; i <= lastDay.toDate().getDate(); i++) {
DayOfMonth dayOfMonth = new DayOfMonth();
DateMidnight currentDay = new DateMidnight(year, month, i);
dayOfMonth.setDayText(currentDay.toString(DATE_FORMAT));
dayOfMonth.setDayNumber(i);
dayOfMonth.setTypeOfDay(getTypeOfDay(person, currentDay));
holidayOverview.getDays().add(dayOfMonth);
}
holidayOverviewList.add(holidayOverview);
}
}
return holidayOverviewList;
}
示例2: isBeforeApril
import org.joda.time.DateMidnight; //导入方法依赖的package包/类
/**
* Check if given date is before April.
*
* @param date
* to check
*
* @return {@code true} if the given date is before April, {@code false} if it is after April
*/
public static boolean isBeforeApril(DateMidnight date) {
return date.getMonthOfYear() < DateTimeConstants.APRIL;
}
示例3: isChristmasEve
import org.joda.time.DateMidnight; //导入方法依赖的package包/类
/**
* Check if given date is on Christmas Eve.
*
* @param date
* to check
*
* @return {@code true} if the given date is on Christmas Eve, else {@code false}
*/
public static boolean isChristmasEve(DateMidnight date) {
return date.getDayOfMonth() == DAY_OF_CHRISTMAS_EVE && date.getMonthOfYear() == DateTimeConstants.DECEMBER;
}
示例4: isNewYearsEve
import org.joda.time.DateMidnight; //导入方法依赖的package包/类
/**
* Check if given date is on New Year's Eve.
*
* @param date
* to check
*
* @return {@code true} if the given date is on New Year's Eve, else {@code false}
*/
public static boolean isNewYearsEve(DateMidnight date) {
return date.getDayOfMonth() == DAY_OF_NEW_YEARS_EVE && date.getMonthOfYear() == DateTimeConstants.DECEMBER;
}