当前位置: 首页>>代码示例>>Java>>正文


Java DateMidnight.getMonthOfYear方法代码示例

本文整理汇总了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;
}
 
开发者ID:synyx,项目名称:urlaubsverwaltung,代码行数:34,代码来源:VacationOverviewService.java

示例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;
}
 
开发者ID:synyx,项目名称:urlaubsverwaltung,代码行数:13,代码来源:DateUtil.java

示例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;
}
 
开发者ID:synyx,项目名称:urlaubsverwaltung,代码行数:13,代码来源:DateUtil.java

示例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;
}
 
开发者ID:synyx,项目名称:urlaubsverwaltung,代码行数:13,代码来源:DateUtil.java


注:本文中的org.joda.time.DateMidnight.getMonthOfYear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。