當前位置: 首頁>>代碼示例>>Java>>正文


Java LocalDate.minusWeeks方法代碼示例

本文整理匯總了Java中java.time.LocalDate.minusWeeks方法的典型用法代碼示例。如果您正苦於以下問題:Java LocalDate.minusWeeks方法的具體用法?Java LocalDate.minusWeeks怎麽用?Java LocalDate.minusWeeks使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.time.LocalDate的用法示例。


在下文中一共展示了LocalDate.minusWeeks方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: calculateStartDate

import java.time.LocalDate; //導入方法依賴的package包/類
private LocalDate calculateStartDate() {
    LocalDate startDate = getDate();

    if (isAdjustToFirstDayOfWeek()) {
        LocalDate newStartDate = startDate.with(DAY_OF_WEEK, getFirstDayOfWeek().getValue());
        if (newStartDate.isAfter(startDate)) {
            startDate = newStartDate.minusWeeks(1);
        } else {
            startDate = newStartDate;
        }
    }

    return startDate;
}
 
開發者ID:dlemmermann,項目名稱:CalendarFX,代碼行數:15,代碼來源:WeekView.java

示例2: getDate

import java.time.LocalDate; //導入方法依賴的package包/類
private LocalDate getDate(LocalDate startDate, int dayCount) {
    if (getSkinnable().isAdjustToFirstDayOfWeek()) {
        LocalDate newStartDate = startDate.with(DAY_OF_WEEK, getSkinnable().getFirstDayOfWeek().getValue());
        if (newStartDate.isAfter(startDate)) {
            startDate = newStartDate.minusWeeks(1);
        } else {
            startDate = newStartDate;
        }
    }

    return startDate.plusDays(dayCount);
}
 
開發者ID:dlemmermann,項目名稱:CalendarFX,代碼行數:13,代碼來源:WeekDayHeaderViewSkin.java

示例3: adjustToFirstDayOfWeek

import java.time.LocalDate; //導入方法依賴的package包/類
/**
 * Adjusts the given date to a new date that marks the beginning of the week where the
 * given date is located. If "Monday" is the first day of the week and the given date
 * is a "Wednesday" then this method will return a date that is two days earlier than the
 * given date.
 *
 * @param date           the date to adjust
 * @param firstDayOfWeek the day of week that is considered the start of the week ("Monday" in Germany, "Sunday" in the US)
 * @return the date of the first day of the week
 * @see #adjustToLastDayOfWeek(LocalDate, DayOfWeek)
 * @see DateControl#getFirstDayOfWeek()
 */
public static LocalDate adjustToFirstDayOfWeek(LocalDate date, DayOfWeek firstDayOfWeek) {
    LocalDate newDate = date.with(DAY_OF_WEEK, firstDayOfWeek.getValue());
    if (newDate.isAfter(date)) {
        newDate = newDate.minusWeeks(1);
    }

    return newDate;
}
 
開發者ID:dlemmermann,項目名稱:CalendarFX,代碼行數:21,代碼來源:Util.java


注:本文中的java.time.LocalDate.minusWeeks方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。